diff options
Diffstat (limited to 'tests/test_models.py')
-rw-r--r-- | tests/test_models.py | 29 |
1 files changed, 11 insertions, 18 deletions
diff --git a/tests/test_models.py b/tests/test_models.py index 37e9c03..c94756d 100644 --- a/tests/test_models.py +++ b/tests/test_models.py @@ -1,28 +1,21 @@ import pytest from pydantic import ValidationError -from poker.constants import Suit, Value +from poker.constants import Value from poker.models import Card, Hand +from tests.conftest import Factory -def test_hand_should_contain_unique_cards() -> None: +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=( - Card(suit=Suit.CLUBS, value=Value.ACE), - Card(suit=Suit.CLUBS, value=Value.TWO), - Card(suit=Suit.CLUBS, value=Value.THREE), - Card(suit=Suit.CLUBS, value=Value.FOUR), - Card(suit=Suit.CLUBS, value=Value.FOUR), - ) + cards=tuple(card_factory(value=value) for value in cards + [Value.FOUR]) ) - _ = Hand( - cards=( - Card(suit=Suit.CLUBS, value=Value.ACE), - Card(suit=Suit.CLUBS, value=Value.TWO), - Card(suit=Suit.CLUBS, value=Value.THREE), - Card(suit=Suit.CLUBS, value=Value.FOUR), - Card(suit=Suit.CLUBS, value=Value.FIVE), - ) - ) + _ = Hand(cards=tuple(card_factory(value=value) for value in cards + [Value.FIVE])) |