def test_game_finishes_if_player_collects_21(self):
        p1 = FakePlayer("p1", 100, [STAY, STAY])
        p2 = FakePlayer("DEALER", 100)

        game = Game(50, [p1, p2])
        deck = Deck()
        deck.deck = [
            (2, Deck.HEARTS),  # p1
            (8, Deck.CLUBS),  # p2
            (3, Deck.HEARTS),  # p1
            (2, Deck.CLUBS),  # p2
            (Deck.ACE, Deck.CLUBS),  # p2
            (Deck.ACE, Deck.HEARTS)  # game must be finished here
        ]

        play(game, deck)
        self.assertEqual(game.winner, p2)
        self.assertEqual(p2.balance, 150)
        self.assertEqual(p1.balance, 50)
    def test_game_finishes_when_one_player_left(self):
        p1 = FakePlayer("p1", 100)
        p2 = FakePlayer("p2", 100)

        game = Game(50, [p1, p2])
        deck = Deck()
        deck.deck = [
            (9, Deck.HEARTS),  # p1
            (8, Deck.CLUBS),  # p2
            (8, Deck.HEARTS),  # p1
            (2, Deck.CLUBS),  # p2
            (Deck.JACK, Deck.CLUBS),  # p2
            (Deck.ACE, Deck.HEARTS)  # game must be finished here
        ]

        play(game, deck)

        self.assertEqual(game.winner, p2)
        self.assertEqual(p2.balance, 150)
        self.assertEqual(p1.balance, 50)