def test_print_summary_at_start(self): human = HumanPlayer('john') human._hand = [(3, 'L'), (5, 'H'), (9, '$')] state = GameState() state.human_player = human state.players = [human] with captured_output() as (out, err): print_summary(state) self.assertEqual('Game Summary\n' 'Your hand: 3L 5H 9$\n' 'Secret to play: [john: 1]', output(out))
def test_print_summary_with_extra_card_and_low_suit(self): human = HumanPlayer('john') human._hand = [(3, 'L'), (5, 'H'), (9, '$')] human.set_low_suit('H') state = GameState() state.human_player = human state.players = [human] state.extra_card = (5, 'L') with captured_output() as (out, err): self.assertFalse(print_summary(state)) self.assertEqual( 'Game Summary\n' 'Your hand: 3L 5H 9$\n' 'Extra card: 5L\n' 'Low Suits: [john: H]\n' 'Secret to play: [john: 1]', output(out))