From 5c919160e3c6c3476f7ffc760a16c279b93891bd Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Thu, 4 Apr 2024 17:06:26 +0200 Subject: First useful code --- src/match_up/tests/__init__.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 src/match_up/tests/__init__.py (limited to 'src/match_up/tests/__init__.py') diff --git a/src/match_up/tests/__init__.py b/src/match_up/tests/__init__.py new file mode 100644 index 0000000..0a2bd15 --- /dev/null +++ b/src/match_up/tests/__init__.py @@ -0,0 +1,16 @@ +from os import remove +from pathlib import PurePath +from names import get_first_name, get_last_name +from match_up.model import Player, PlayerDatabase + +TEST_DATABASE_LOCATION = PurePath("test_storage.json") + + +def generate_test_database(total_players: int = 10) -> None: + p = PlayerDatabase(TEST_DATABASE_LOCATION) + for _ in range(total_players): + p.add_player(Player(first_name=get_first_name(), last_name=get_last_name())) + + +def remove_test_database() -> None: + remove(TEST_DATABASE_LOCATION) -- cgit v1.3.1