コード例 #1
0
 def test_player_position_changes(self):
     """
     Tests that player position changes after a move
     """
     p = cs.Player()
     p.move()
     assert p.position != 0
コード例 #2
0
def test_move():
    """
    Tests whether the player has moved a position
    """
    player = sa.Player(sa.Board())
    first_pos = player.position
    player.move()
    second_pos = player.position
    assert first_pos != second_pos
コード例 #3
0
    def test_position_not_equal_one(self):
        """Test that the players position is not less than 1 after moving,
        since this is not possible"""

        board = cs.Board()
        player = cs.Player(board)

        for _ in range(50):
            player.move()
            assert 1 <= player.position
コード例 #4
0
    def test_move(self):
        """Tests if the players in Player Class takes the right amounts of
        moves"""

        board = cs.Board()
        player = cs.Player(board)
        for _ in range(10):
            player.move()

        assert player.number_of_moves == 10
コード例 #5
0
    def test_position(self):
        """Tests that the player actually moves, when function move is
        called upon. So start position can not be equal to end position  """

        board = cs.Board()
        player = cs.Player(board)
        start_pos = player.position
        player.move()
        end_pos = player.position

        assert start_pos is not end_pos
コード例 #6
0
ファイル: test_pa02.py プロジェクト: marisha-g/INF200-2019
    def test_move_player(self):
        """
        Player can move.
        """
        b = cs.Board()
        p = cs.Player(b)
        p.move()

        assert p.player_position > 0
        assert p.player_position not in b.chutes.keys() and b.ladders.keys()

        position1 = p.player_position
        p.move()
        assert p.player_position != position1
コード例 #7
0
 def test_move(self):
     """Tests if turns is increased by one, and position is changed after
     move."""
     b = cs.Board()
     p = cs.Player(b)
     turns_before = p.turns
     position_before = p.position
     p.move()
     assert p.turns == turns_before + 1
     assert p.position != position_before
     p.position = 22
     random.seed(1)
     p.move()
     random.seed(1)
     p.move()
     assert p.position == 7
コード例 #8
0
 def test_move(self):
     """Player has move() method."""
     b = cs.Board()
     p = cs.Player(b)
     p.move()
コード例 #9
0
 def test_constructor(self):
     """Player can be constructed."""
     b = cs.Board()
     p = cs.Player(b)
     assert isinstance(p, cs.Player)