poker-ranking-service/tests/test_models.py

22 lines
580 B
Python
Raw Normal View History

import pytest
from pydantic import ValidationError
2022-11-18 20:27:21 +00:00
from poker.constants import Value
from poker.models import Card, Hand
2022-11-18 20:27:21 +00:00
from tests.conftest import Factory
2022-11-18 20:27:21 +00:00
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(
2022-11-18 20:27:21 +00:00
cards=tuple(card_factory(value=value) for value in cards + [Value.FOUR])
)
2022-11-18 20:27:21 +00:00
_ = Hand(cards=tuple(card_factory(value=value) for value in cards + [Value.FIVE]))