Fix salary tool edge cases (#75)

* fix: handle salary tool edge cases

* fix: preserve Danish salary compounds
This commit is contained in:
Kushida
2026-07-08 21:12:36 +02:00
committed by GitHub
parent d4415dff16
commit 9e26de2c67
4 changed files with 68 additions and 10 deletions
+17
View File
@@ -37,6 +37,13 @@ class DetectColumnTypeTests(unittest.TestCase):
with self.subTest(header=header):
self.assertEqual(detect_column_type(header), "count")
def test_count_inside_word_does_not_make_count_header(self):
self.assertIsNone(detect_column_type("Accounting Total"))
self.assertEqual(detect_column_type("Accounting Index"), "index")
def test_danish_compound_headers_still_match(self):
self.assertEqual(detect_column_type("Lønindeks"), "index")
def test_parse_sheet_preserves_category_name_with_letter_n(self):
ws = FakeWorksheet([
("Company", "Engineering Count", "Engineering Index"),
@@ -47,6 +54,16 @@ class DetectColumnTypeTests(unittest.TestCase):
self.assertEqual(companies[0]["categories"]["engineering"], {"count": 12, "index": 105.5})
def test_parse_sheet_groups_accounting_count_index_pair(self):
ws = FakeWorksheet([
("Company", "Accounting Count", "Accounting Index"),
("Example Corp", 12, 105.5),
])
companies = parse_sheet(ws)
self.assertEqual(companies[0]["categories"]["accounting"], {"count": 12, "index": 105.5})
if __name__ == "__main__":
unittest.main()