示例#1
0
 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()
示例#2
0
 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], [], [], [], [], [], [], [], [
     ], [], [], []], [[], [], [], [], [], [], [], [], [], [], [], []])
示例#3
0
    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)