diff options
| author | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-04-04 21:06:37 +0200 |
|---|---|---|
| committer | Karan Jayachandra <karan.jayachandra@nxp.com> | 2024-04-04 21:06:37 +0200 |
| commit | bd3bd7de2fdb6cdb181a9b02b627c98c712f3739 (patch) | |
| tree | 506a7de3235a9ee43879a3c3e683944abfc8af84 /src/match_up/tests | |
| parent | 5c919160e3c6c3476f7ffc760a16c279b93891bd (diff) | |
Generating test data possible
Diffstat (limited to 'src/match_up/tests')
| -rw-r--r-- | src/match_up/tests/__init__.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/src/match_up/tests/__init__.py b/src/match_up/tests/__init__.py index 0a2bd15..38e377f 100644 --- a/src/match_up/tests/__init__.py +++ b/src/match_up/tests/__init__.py @@ -1,15 +1,24 @@ from os import remove +from random import randint 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") +MIN_SKILL = 1 +MAX_SKILL = 10 -def generate_test_database(total_players: int = 10) -> None: +def generate_test_database(total_players: int = 20, active_players: int = 17) -> 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())) + p.add_player( + Player( + first_name=get_first_name(), + last_name=get_last_name(), + skill=randint(MIN_SKILL, MAX_SKILL), + ) + ) def remove_test_database() -> None: |
