def test_draw_all_cards(self, _random_module): deck = Deck() # Not using fixture because of 'hypothesis' for _ in range(0, 20): deck.draw_card() with pytest.raises(RuntimeError, match=r'.*empty.*'): deck.draw_card()
def test_cards_left(self, _random_module): deck = Deck() deck.cards = [Card(0), Card(0), Card(8)] assert deck.cards_left() == 3 deck.draw_card() assert deck.cards_left() == 2
def test_drawn_card_is_not_in_deck_anymore(self, _random_module): deck = Deck() # Not using fixture because of 'hypothesis' card = deck.draw_card() cards_in_deck_after_draw = deck.cards.copy() assert card not in cards_in_deck_after_draw
def test_draw_card_draws_random_card_from_deck(self, _random_module): deck = Deck() # Not using fixture because of 'hypothesis' cards_in_deck_before_draw = deck.cards.copy() card = deck.draw_card() assert card in cards_in_deck_before_draw