Compare commits

..

3 Commits

Author SHA1 Message Date
d57022f742 cleanup 2025-11-06 20:00:39 +01:00
a3aa761739 added test for Player() 2025-11-06 20:00:22 +01:00
4222e76262 added exception for keyboard interrupt 2025-11-06 19:44:05 +01:00
2 changed files with 34 additions and 3 deletions

View File

@@ -8,6 +8,9 @@ if __name__ == "__main__":
print("do you wanna play a round??")
game = Game()
while True:
# os.system("clear")
game.play_round()
try:
while True:
game.play_round()
except KeyboardInterrupt:
print("End Program")

28
tests/test_player.py Normal file
View File

@@ -0,0 +1,28 @@
import pytest
from pyjack.player import Player
from pyjack.deck import Deck
# Start Fixtures
@pytest.fixture
def player() -> Player:
"""Fixture for the player test."""
player = Player(0)
return player
@pytest.fixture
def deck() -> Deck:
deck = Deck()
return deck
# Start Tests:
def test_player_hit_one_card(player, deck):
player.hit(deck)
assert len(player.hand.cards) == 1