Skip to content

Commit

Permalink
Close file object once
Browse files Browse the repository at this point in the history
  • Loading branch information
youpong committed Oct 11, 2024
1 parent bb72eea commit 51a5319
Show file tree
Hide file tree
Showing 13 changed files with 0 additions and 13 deletions.
1 change: 0 additions & 1 deletion tests/module_tests/test_constructor_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_constructor_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_driver_info.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_driver_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_finishing_status.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_lap_times.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_pitstops.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ class TestPitStops:
encoding="utf-8") as f:

data = json.load(f)
f.close()

p_stops = PitStops(data)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_qualifying_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_race_circuits.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_race_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_race_winners.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/module_tests/test_sprint_results.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 0 additions & 1 deletion tests/package_tests/base_test_class.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 51a5319

Please sign in to comment.