From 51a5319e7ec6850b455c1371baeb43d966577fb1 Mon Sep 17 00:00:00 2001 From: NAKAJIMA Yusaku Date: Sat, 12 Oct 2024 01:45:38 +0900 Subject: [PATCH] Close file object once --- tests/module_tests/test_constructor_info.py | 1 - tests/module_tests/test_constructor_results.py | 1 - tests/module_tests/test_driver_info.py | 1 - tests/module_tests/test_driver_results.py | 1 - tests/module_tests/test_finishing_status.py | 1 - tests/module_tests/test_lap_times.py | 1 - tests/module_tests/test_pitstops.py | 1 - tests/module_tests/test_qualifying_results.py | 1 - tests/module_tests/test_race_circuits.py | 1 - tests/module_tests/test_race_schedule.py | 1 - tests/module_tests/test_race_winners.py | 1 - tests/module_tests/test_sprint_results.py | 1 - tests/package_tests/base_test_class.py | 1 - 13 files changed, 13 deletions(-) diff --git a/tests/module_tests/test_constructor_info.py b/tests/module_tests/test_constructor_info.py index 2a6f205..1441f61 100644 --- a/tests/module_tests/test_constructor_info.py +++ b/tests/module_tests/test_constructor_info.py @@ -12,7 +12,6 @@ class TestConstructorInfo: with open("tests/test_data/module_data/sample_constructor_info_2010.json", encoding="utf-8") as f: data = json.load(f) - f.close() constructor = ConstructorInfo(data) diff --git a/tests/module_tests/test_constructor_results.py b/tests/module_tests/test_constructor_results.py index f6634b8..92860d1 100644 --- a/tests/module_tests/test_constructor_results.py +++ b/tests/module_tests/test_constructor_results.py @@ -11,7 +11,6 @@ class TestConstructorResults: data = "" with open("tests/test_data/module_data/top_3_constructors_2008.json", encoding="utf-8") as f: data = json.load(f) - f.close() c_res = ConstructorResults(data) diff --git a/tests/module_tests/test_driver_info.py b/tests/module_tests/test_driver_info.py index b960b94..1dc7686 100644 --- a/tests/module_tests/test_driver_info.py +++ b/tests/module_tests/test_driver_info.py @@ -12,7 +12,6 @@ class TestDriverInfo: with open("tests/test_data/module_data/sample_drivers_info_2000.json", encoding="utf-8") as f: data = json.load(f) - f.close() driver = DriverInfo(data) diff --git a/tests/module_tests/test_driver_results.py b/tests/module_tests/test_driver_results.py index 3d36ff5..22a855b 100644 --- a/tests/module_tests/test_driver_results.py +++ b/tests/module_tests/test_driver_results.py @@ -11,7 +11,6 @@ class TestDriverResults: data = "" with open("tests/test_data/module_data/top_3_drivers_2008.json", encoding="utf-8") as f: data = json.load(f) - f.close() d_res = DriverResults(data) diff --git a/tests/module_tests/test_finishing_status.py b/tests/module_tests/test_finishing_status.py index 2af8014..ff3fe5e 100644 --- a/tests/module_tests/test_finishing_status.py +++ b/tests/module_tests/test_finishing_status.py @@ -11,7 +11,6 @@ class TestFinishingStatus: data = "" with open("tests/test_data/module_data/top_3_status_2010.json", encoding='utf-8') as f: data = json.load(f) - f.close() f_status = FinishingStatus(data) diff --git a/tests/module_tests/test_lap_times.py b/tests/module_tests/test_lap_times.py index 2de4811..a49df20 100644 --- a/tests/module_tests/test_lap_times.py +++ b/tests/module_tests/test_lap_times.py @@ -11,7 +11,6 @@ class TestLapTimes: data = "" with open("tests/test_data/module_data/sample_lap_times_2008.json", encoding="utf-8") as f: data = json.load(f) - f.close() l_times = LapTimes(data) diff --git a/tests/module_tests/test_pitstops.py b/tests/module_tests/test_pitstops.py index 4bd19e5..1bc24fd 100644 --- a/tests/module_tests/test_pitstops.py +++ b/tests/module_tests/test_pitstops.py @@ -13,7 +13,6 @@ class TestPitStops: encoding="utf-8") as f: data = json.load(f) - f.close() p_stops = PitStops(data) diff --git a/tests/module_tests/test_qualifying_results.py b/tests/module_tests/test_qualifying_results.py index 8127967..d691c54 100644 --- a/tests/module_tests/test_qualifying_results.py +++ b/tests/module_tests/test_qualifying_results.py @@ -12,7 +12,6 @@ class TestQualifyingResults: with open("tests/test_data/module_data/first_3_qualifying_results_2022.json", encoding="utf-8") as f: data = json.load(f) - f.close() r_obj = QualifyingResults(data) diff --git a/tests/module_tests/test_race_circuits.py b/tests/module_tests/test_race_circuits.py index e450beb..389da3c 100644 --- a/tests/module_tests/test_race_circuits.py +++ b/tests/module_tests/test_race_circuits.py @@ -10,7 +10,6 @@ class TestRaceCircuits: data = "" with open("tests/test_data/module_data/first_3_race_circuits.json", encoding="utf-8") as f: data = json.load(f) - f.close() c_obj = RaceCircuits(data) def test_get_circuit_name(self): diff --git a/tests/module_tests/test_race_schedule.py b/tests/module_tests/test_race_schedule.py index f187c96..4d30843 100644 --- a/tests/module_tests/test_race_schedule.py +++ b/tests/module_tests/test_race_schedule.py @@ -11,7 +11,6 @@ class TestRaceSchedule: data = "" with open("tests/test_data/module_data/first_3_races_2008.json", encoding="utf-8") as f: data = json.load(f) - f.close() r_sched = RaceSchedule(data) diff --git a/tests/module_tests/test_race_winners.py b/tests/module_tests/test_race_winners.py index d700f29..fa79898 100644 --- a/tests/module_tests/test_race_winners.py +++ b/tests/module_tests/test_race_winners.py @@ -11,7 +11,6 @@ class TestRaceWinners: data = "" with open("tests/test_data/module_data/first_3_winners_2008.json", encoding="utf-8") as f: data = json.load(f) - f.close() r_win = RaceWinners(data) diff --git a/tests/module_tests/test_sprint_results.py b/tests/module_tests/test_sprint_results.py index f8ecdb2..5ffa710 100644 --- a/tests/module_tests/test_sprint_results.py +++ b/tests/module_tests/test_sprint_results.py @@ -11,7 +11,6 @@ class TestSprintResults: data = "" with open("tests/test_data/module_data/top_3_sprint_2022_11.json", encoding='utf-8') as f: data = json.load(f) - f.close() s_result = SprintResults(data) diff --git a/tests/package_tests/base_test_class.py b/tests/package_tests/base_test_class.py index 2617a4a..e0a970e 100644 --- a/tests/package_tests/base_test_class.py +++ b/tests/package_tests/base_test_class.py @@ -18,6 +18,5 @@ def get_data(self, file_name): data = "" with open(f"tests/test_data/api_data/{file_name}", encoding="utf-8") as data_file: data = self.json.load(data_file) - data_file.close() return data