test_gchr.py 1.1 KB

1234567891011121314151617181920212223242526272829
  1. import unittest
  2. import pandas as pd
  3. from gcstruct.gchr import GCHR, TRANSLATE
  4. class TestGchr(unittest.TestCase):
  5. base_dir_1: str = "C:\\Projekte\\GCHR2_Testdaten\\Kunden\\Altermann"
  6. base_dir_2: str = "C:\\Projekte\\GCHR2_Testdaten\\Kunden\\Koenig-und-Partner"
  7. def test_single_booking_files(self):
  8. gchr = GCHR(self.base_dir_1)
  9. self.assertEqual(len(gchr.account_bookings), 1)
  10. self.assertEqual(gchr.account_bookings[0].name, "GuV_Bilanz_Salden.csv")
  11. def test_multiple_booking_files(self):
  12. gchr = GCHR(self.base_dir_2)
  13. self.assertEqual(len(gchr.account_bookings), 2)
  14. self.assertEqual(gchr.account_bookings[0].name, "GuV_Bilanz_Salden.csv")
  15. self.assertEqual(gchr.account_bookings[1].name, "GuV_Bilanz_Salden_deop03.csv")
  16. def test_translation_existing(self):
  17. gchr = GCHR(self.base_dir_1)
  18. df = gchr.df_translate
  19. self.assertIsInstance(df, pd.DataFrame)
  20. self.assertEqual(df.shape[1], 12)
  21. self.assertListEqual(list(df.columns), TRANSLATE)
  22. self.assertGreater(df.shape[0], 0, "Translation not empty")