コード例 #1
0
    def test_get_current_generation(self):
        """
        This method tests the ability of the Controller to retrieve the Game of Life's current generation. The
        expected result of this test is for the Game of Life's current generation to be correctly retrieved as a
        GolGrid object.
        """
        golc = GameOfLifeController()
        golc.set_up_game(create_initial_input())

        current_gen = golc.get_current_generation()
        # Assert that the current generation has been retrieved, and that it has been retrieved as the correct Grid
        # type.
        assert current_gen and isinstance(current_gen, GolGrid)
コード例 #2
0
    def test_get_current_generation_output(self):
        """
        Tests the game controller's ability to output the current
        generation as a string.

        This method tests the Controller's ability to retrieve the Game of Life#s current generation. The expected
        result of this test is for the Game of Life's current generation to be correctly retrieved as a string object.
        """
        golc = GameOfLifeController()
        golc.set_up_game(create_initial_input())

        current_gen = golc.get_current_generation(output=True)
        # Assert that the current generation has been retrieved, and that it has been retrieved as the correct string
        # type.
        assert current_gen and isinstance(current_gen, str)