added tests

This commit is contained in:
2025-10-28 21:04:39 +01:00
parent 2364b6bbca
commit ed494ec8b2
4 changed files with 82 additions and 0 deletions

26
tests/test_deck.py Normal file
View File

@@ -0,0 +1,26 @@
import pytest
from pyjack.deck import Deck
@pytest.fixture
def default_deck() -> Deck:
deck = Deck()
return deck
def test_deck_init(default_deck):
"""Tests if the right amount of cards is created"""
assert len(default_deck.cards) == 52
def test_shuffle_deck(default_deck):
"""Tests if the deck is randomized after method call"""
assert default_deck != default_deck.shuffle()
def test_card_dealing(default_deck):
"""Tests if the a card is correctly removed from the deck."""
default_deck.shuffle()
removed_card = default_deck.deal_card()
assert len(default_deck.cards) == 51
assert removed_card is not None