aboutsummaryrefslogtreecommitdiff
path: root/tests/test_models.py
blob: c94756db36454cb6811339d61c7dff2a439edc37 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import pytest
from pydantic import ValidationError

from poker.constants import Value
from poker.models import Card, Hand
from tests.conftest import Factory


def test_hand_should_contain_unique_cards(card_factory: Factory[Card]) -> None:
    cards = [
        Value.ACE,
        Value.TWO,
        Value.THREE,
        Value.FOUR,
    ]
    with pytest.raises(ValidationError):
        _ = Hand(
            cards=tuple(card_factory(value=value) for value in cards + [Value.FOUR])
        )

    _ = Hand(cards=tuple(card_factory(value=value) for value in cards + [Value.FIVE]))