123456789101112131415161718192021222324252627282930313233343536373839 |
- import unittest
- import pandas as pd
- from gchr.gchr import GCHR
- from gchr.gchr_bookings import GchrBookings
- from gchr.gchr_translate import TRANSLATE
- class TestGchr(unittest.TestCase):
- base_dir_1: str = "C:\\Projekte\\GCHR2_Testdaten\\Kunden\\Altermann"
- base_dir_2: str = "C:\\Projekte\\GCHR2_Testdaten\\Kunden\\Koenig-und-Partner"
- def test_single_booking_files(self):
- gchr = GCHR(self.base_dir_1)
- self.assertIsInstance(gchr.bookings, GchrBookings)
- self.assertEqual(len(gchr.bookings.account_bookings), 1)
- self.assertEqual(gchr.bookings.account_bookings[0].name, "GuV_Bilanz_Salden.csv")
- def test_multiple_booking_files(self):
- gchr = GCHR(self.base_dir_2)
- self.assertIsInstance(gchr.bookings, GchrBookings)
- self.assertEqual(len(gchr.bookings.account_bookings), 2)
- self.assertEqual(gchr.bookings.account_bookings[0].name, "GuV_Bilanz_Salden.csv")
- self.assertEqual(gchr.bookings.account_bookings[1].name, "GuV_Bilanz_Salden_deop03.csv")
- def test_translation_existing(self):
- gchr = GCHR(self.base_dir_1)
- df = gchr.df_translate
- self.assertIsInstance(df, pd.DataFrame)
- self.assertEqual(df.shape[1], 12)
- self.assertListEqual(list(df.columns), TRANSLATE)
- self.assertGreater(df.shape[0], 0, "Translation not empty")
- def test_all_periods(self):
- periods = GCHR.get_all_periods("2024-12-23")
- self.assertEqual(len(periods), 12)
- self.assertEqual(periods[0], ("2023", "12"))
- self.assertEqual(periods[-1], ("2024", "11"))
|