コード例 #1
0
    def test_init_get_pass_direction(self):
        game = HeartsGame()

        try:
            game.get_pass_direction()
            self.fail()
        except e.PassingNotInProgressError:
            pass  # test succeeded
コード例 #2
0
    def test_start_game_preround(self):
        """
        When the game is started,
        it should go into the first pre-round,
        passing left.
        """
        game = HeartsGame(deal_func=lambda: example_hands)
        observer = Mock()
        game.add_observer(observer)

        game.start()

        self.assertEqual("passing", game.get_state())
        self.assertEqual("left", game.get_pass_direction())
        self.assertEqual(example_hands[0], game.get_hand(0))