Skip to content

Commit 9449271

Browse files
committed
TST: Add test that checks sanitize_team_name directly
1 parent 8843e1a commit 9449271

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

test/test_pelita_player.py

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
import pytest
77

8-
from pelita.scripts.pelita_player import load_team, load_team_from_module
8+
from pelita.scripts.pelita_player import load_team, load_team_from_module, sanitize_team_name
99

1010
_mswindows = (sys.platform == "win32")
1111

@@ -169,6 +169,24 @@ def test_player_import_name(name, expected, cleanup_test_modules):
169169
assert load_team(spec).team_name == expected
170170

171171

172+
@pytest.mark.parametrize('name, expected', [
173+
("a", True),
174+
("a a", True),
175+
("0" * 25, True),
176+
("", "???"),
177+
(" ", "???"),
178+
("-", "???"),
179+
("∂", "???"),
180+
("0" * 26, "0" * 25),
181+
(" " + "0" * 26, "0" * 25),
182+
])
183+
def test_sanitize_team_name(name, expected):
184+
if expected is True:
185+
assert sanitize_team_name(name) == name
186+
else:
187+
assert sanitize_team_name(name) == expected
188+
189+
172190
@pytest.mark.parametrize('team_spec, expected', [
173191
("pelita/player/StoppingPlayer", None),
174192
("NonExistingPlayer", ImportError),

0 commit comments

Comments
 (0)