def test_compare_cards_when_equal_cards(self): player = Player(0) cards = [[Card(0, 'A')]] player._check_count = MagicMock() player._check_sequence = MagicMock() self.assertEqual(player._compare_cards(cards, cards), 0) player._check_count.assert_not_called() player._check_sequence.assert_not_called()
def test_compare_cards_when_cards_not_equal(self): player = Player(0) cards1 = [[Card(0, 'A')], []] cards2 = [[], [Card(1, 'K')]] mock = Mock(return_value=0) player._check_count = mock player._check_sequence = mock self.assertEqual(player._compare_cards(cards1, cards2), 1) card_param1 = [['A'], []] card_param2 = [[], ['K']] calls = [call(card_param1, card_param2, 3), call( card_param1, card_param2), call(card_param1, card_param2, 2)] mock.assert_has_calls(calls)
def test_check_count_when_two_triplet(self): player = Player(0) self.assertEqual(player._check_count( [[], ['K', 'K', 'K']], [['A', 'A', 'A'], []], 3), -1)
def test_check_count_when_triplet_and_sequence(self): player = Player(0) self.assertEqual(player._check_count( [[], ['K', 'K', 'K']], [['A'], ['K'], ['Q']], 3), 1)