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_sequence_when_two_sequece(self): player = Player(0) self.assertEqual(player._check_sequence( [['A'], ['K'], ['Q'], []], [[], ['K'], ['Q'], ['10']]), 1)
def test_check_sequence_when_sequece_and_pair(self): player = Player(0) self.assertEqual(player._check_sequence( [['A'], ['K'], ['Q']], [['A'], ['K', 'K']]), 1)