def test_has_better_cards(self): player1 = Player(0) player2 = Player(0) card = Card(0, 'A') player1.add_card(card) player1._compare_cards = MagicMock() player1.has_better_cards(player2) player1._compare_cards.assert_called_with([[card], [], [], [], [], [], [], [], [ ], [], [], []], [[], [], [], [], [], [], [], [], [], [], [], []])
class PlayerTests(unittest.TestCase): """Tests decks""" def setUp(self): self.player = Player() # test get winining value def testGetWininingValue(self): self.player.add_card(Card(suit=0, rank=2)) self.player.add_card(Card(suit=2, rank=5)) self.player.add_card(Card(suit=3, rank=8)) self.player.add_card(Card(suit=2, rank=6)) self.assertTrue(self.player.get_winining_value() ==38)
def test_reset_card(self): player = Player(0) init_cards = player.get_cards() player.add_card(Card(0, 'A')) player.reset_card() self.assertEqual(player.get_cards(), init_cards)
def test_add_card(self): player = Player(0) init_count = len(player.get_cards()[0]) player.add_card(Card(0, 'A')) self.assertEqual(len(player.get_cards()[0]), init_count + 1)