@@ 79-91 (lines=13) @@ | ||
76 | ||
77 | assert new_end_locations == expected_positions |
|
78 | ||
79 | def test_cant_jump_own_pieces_diagonally(self): |
|
80 | start = (0, 2) |
|
81 | middle = (1, 1) |
|
82 | ||
83 | self.chess_board[start] = Mock(color=1) |
|
84 | self.chess_board[middle] = Mock(color=1) |
|
85 | self.chess_board[(2, 0)] = None |
|
86 | ||
87 | starting_end_locations = [(1, 1), (2, 0)] |
|
88 | expected_positions = [(1, 1)] |
|
89 | new_end_locations = cant_jump_pieces(self.chess_board, start, None, starting_end_locations, Mock()) |
|
90 | ||
91 | assert new_end_locations == expected_positions |
|
92 | ||
93 | def test_cant_jump_pieces_divide_by_one_error(self): |
|
94 | start = (2, 2) |
|
@@ 162-171 (lines=10) @@ | ||
159 | ends = ends_on_enemy(self.chess_board, start, None, potential_end_locations, Mock()) |
|
160 | assert ends == [] |
|
161 | ||
162 | def test_ends_on_enemy_players_piece(self): |
|
163 | start = (0, 0) |
|
164 | self.chess_board[start] = Mock(color=1) |
|
165 | potential_end_locations = [(1, 0), (2, 0), (2, 2)] |
|
166 | end = None |
|
167 | for end in potential_end_locations: |
|
168 | self.chess_board[end] = Mock(color=1) |
|
169 | self.chess_board[end] = Mock(color=2) |
|
170 | ends = ends_on_enemy(self.chess_board, start, None, potential_end_locations, Mock()) |
|
171 | assert ends == [(2, 2)] |
|
172 | ||
173 | def test_doesnt_land_on_piece(self): |
|
174 | start = (1, 1) |