From 66725365084fdc9a55b5a92fe0ba3642171a8d12 Mon Sep 17 00:00:00 2001 From: Anthony Correa Date: Fri, 25 Apr 2025 10:49:51 -0400 Subject: [PATCH] Add test support for xlsx file (not tested) --- tests/test_utils.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/test_utils.py b/tests/test_utils.py index 5720617..756d433 100644 --- a/tests/test_utils.py +++ b/tests/test_utils.py @@ -1,7 +1,7 @@ import unittest from pathlib import Path # from convert_to_sportspress -from src.utils.common import validate_csv_header, normalize_header_key, read_and_normalize_csv, parse_score, is_visitor_home_order_reversed, import_gamebygame, aggregate_teams +from src.utils.common import validate_csv_header, normalize_header_key, read_and_normalize_csv_or_xlsx, parse_score, is_visitor_home_order_reversed, import_gamebygame, aggregate_teams from src.utils.normalize import normalize_value, normalize_header_key, load_config import toml @@ -25,11 +25,11 @@ class TestConvertToSportsPress(unittest.TestCase): def test_read_csv(self): # Assuming that the CSV file has a valid header with self.subTest("Read CSV data"): - data = read_and_normalize_csv(self.test_csv_path_2009) + data = read_and_normalize_csv_or_xlsx(self.test_csv_path_2009) self.assertIsInstance(data, list) self.assertTrue(all(isinstance(row, dict) for row in data)) with self.subTest("Normalized keys"): - normalized_data = read_and_normalize_csv(self.test_csv_path_2009) + normalized_data = read_and_normalize_csv_or_xlsx(self.test_csv_path_2009) self.assertTrue(all("visitor" in row.keys() and "results" in row.keys() for row in normalized_data)) def test_parse_score_visitor_first(self): @@ -117,7 +117,7 @@ class TestConvertToSportsPress(unittest.TestCase): def test_process_data(self): # Assuming that the CSV file has a valid header and read_csv is good - data = read_and_normalize_csv(self.test_csv_path_2009) + data = read_and_normalize_csv_or_xlsx(self.test_csv_path_2009) processed_data = import_gamebygame(data) aggregate_team_data = aggregate_teams(processed_data) expected_result = [