test_task1.py 556 Bytes
import pytest
from tests.helpers.test_helpers import *
from src import task1

@pytest.mark.parametrize('player, expected', [
    (0, 1),
    (1, 0),
])
def test_get_opponent(player, expected):
    result = task1.get_opponent(player)
    assert result == expected, f"get_opponent({player}) returned {result}, but the expected value is {expected}."


@pytest.mark.parametrize('invalid_player', [
    -1,
    -2,
    2,
    3,
    1000,
    3.1415,
    9
])
def test_get_opponent_invalid_does_not_crash(invalid_player):
    task1.get_opponent(invalid_player)