From bd3bd7de2fdb6cdb181a9b02b627c98c712f3739 Mon Sep 17 00:00:00 2001 From: Karan Jayachandra Date: Thu, 4 Apr 2024 21:06:37 +0200 Subject: Generating test data possible --- src/match_up/tests/__init__.py | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) (limited to 'src/match_up/tests') 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: -- cgit v1.3.1