diff --git a/src/arcaea_offline/calculators/play_result.py b/src/arcaea_offline/calculators/play_result.py index 446d92c..4aa2a02 100644 --- a/src/arcaea_offline/calculators/play_result.py +++ b/src/arcaea_offline/calculators/play_result.py @@ -7,7 +7,7 @@ from arcaea_offline.constants.play_result import ScoreLowerLimits class PlayResultCalculators: @staticmethod - def score_possible_range(notes: int, pure: int, far: int) -> tuple[int, int]: + def score_possible_range(notes: int, pure: int, far: int) -> Tuple[int, int]: """ Returns the possible range of score based on the given values. diff --git a/tests/external/importers/arcaea/test_st3.py b/tests/external/importers/arcaea/test_st3.py index 6b8d004..0007c34 100644 --- a/tests/external/importers/arcaea/test_st3.py +++ b/tests/external/importers/arcaea/test_st3.py @@ -1,6 +1,5 @@ import sqlite3 from datetime import datetime -from importlib.resources import files import pytest from arcaea_offline.constants.enums.arcaea import ( @@ -14,7 +13,7 @@ import tests.resources class TestSt3Parser: - DB_PATH = files(tests.resources).joinpath("st3-test.db") + DB_PATH = tests.resources.get_resource("st3-test.db") @property def play_results(self): diff --git a/tests/resources/__init__.py b/tests/resources/__init__.py index e69de29..8427c17 100644 --- a/tests/resources/__init__.py +++ b/tests/resources/__init__.py @@ -0,0 +1,16 @@ +import importlib.resources +import sys + + +def get_resource(path: str): + """ + A wrapper for `importlib.resources.files()` since it's not available in Python 3.8. + """ + if sys.version_info >= (3, 9, 0): + with importlib.resources.as_file( + importlib.resources.files(__name__).joinpath(path) + ) as resource_path: + return resource_path + + with importlib.resources.path(__name__, path) as resource_path: + return resource_path