def test_has_rings2(self): """ Test if a player has no rings. """ p = Player('w') p.set_rings([]) self.assertFalse(p.has_rings())
def test_has_rings3(self): """ Test if a player has multiple rings. """ p = Player('b') p.set_rings([(14, 19), (12, 2)]) self.assertTrue(p.has_rings())
def test_set_rings2(self): """ Test if a player can have multiple rings. """ p = Player('w') p.set_rings([(14, 19), (12, 2)]) self.assertListEqual([(14, 19), (12, 2)], p.get_rings())
def test_set_rings3(self): """ Test if a players rings can be emptied. """ p = Player('b') p.set_rings([]) self.assertListEqual([], p.get_rings())
def test_set_rings1(self): """ Test if a players ring can be changed. """ p = Player('b') p.set_rings([(15, 17)]) self.assertListEqual([(15, 17)], p.get_rings())
def test_is_player_piece3(self): """ Tests if a black piece is not returned for the white player. """ b = Board() p = Player('w') piece = b.get_piece((2, 2)) self.assertFalse(b.is_player_piece(p, piece))
def test_is_player_piece2(self): """ Tests if a white piece can be identified for the white player. """ b = Board() p = Player('w') piece = b.get_piece((17, 2)) self.assertTrue(b.is_player_piece(p, piece))
def test_is_player_piece6(self): """ Tests if an empty piece is handled properly for a black player. """ b = Board() p = Player('b') piece = b.get_piece((10, 10)) self.assertFalse(b.is_player_piece(p, piece))
def test_is_player_piece4(self): """ Tests if a white piece is not returned for the black player. """ b = Board() p = Player('b') piece = b.get_piece((17, 2)) self.assertFalse(b.is_player_piece(p, piece))
def test_is_player_piece1(self): """ Tests if a black piece can be identified for the black player. """ b = Board() p = Player('b') piece = b.get_piece((2, 2)) self.assertTrue(b.is_player_piece(p, piece))
def test_move_piece1(self): """ Test a move from the the gutter. """ b = Board() p = Player('b') error = False try: b.move_piece(p, 'a2', 'b2') except IllegalMove: error = True self.assertTrue(error)
def test_move_piece2(self): """ Test a move to the gutter. """ b = Board() p = Player('b') error = False try: b.move_piece(p, 'c3', 'c1') except IllegalMove: error = True self.assertTrue(error)
def test_move_piece3(self): """ Test a move of the wrong color piece. """ b = Board() p = Player('b') error = False try: b.move_piece(p, 'c17', 'c16') except IllegalMove: error = True self.assertTrue(error)
def test_move_piece4(self): """ Test a move in an illegal direction. """ b = Board() p = Player('b') error = False try: b.move_piece(p, 'd3', 'd4') except IllegalMove: error = True self.assertTrue(error)
def test_move_piece5(self): """ Test a move of an illegal distance. """ b = Board() p = Player('b') error = False try: b.move_piece(p, 'c6', 'c12') except IllegalMove: error = True self.assertTrue(error)
def test_move_piece6(self): """ Test a legal move. """ b = Board() p = Player('b') expected_piece = { (4, 1): "", (4, 2): "b", (4, 3): "", (3, 1): "b", (3, 2): "b", (3, 3): "b", (2, 1): "", (2, 2): "b", (2, 3): "" } b.move_piece(p, 'c3', 'c4') self.assertDictEqual(expected_piece, b.get_piece((3, 2)))
def test_is_player_piece8(self): """ Tets if a contended piece is handled properly for a black player. """ b = Board() p = Player('w') target = { (5, 1): "", (5, 2): "w", (5, 3): "w", (4, 1): "w", (4, 2): "w", (4, 3): "w", (3, 1): "w", (3, 2): "w", (3, 3): "w" } b.place_piece(target) piece = b.get_piece((2, 2)) self.assertFalse(b.is_player_piece(p, piece))
def test_get_stone_black(self): """ Tests making a black player. """ p = Player('b') self.assertEqual('b', p.get_stone())
def test_get_color_black(self): """ Tests to get the long form color of a black player. """ p = Player('b') self.assertEqual('BLACK', p.get_color())
def test_get_rings1(self): """ Tests if the default ring will be returned for white. """ p = Player('w') self.assertListEqual([(17, 11)], p.get_rings())
def test_get_rings2(self): """ Tests if the default ring will be returned for black. """ p = Player('b') self.assertListEqual([(2, 11)], p.get_rings())
def test_has_rings1(self): """ Test confirming a player has rings. """ p = Player('b') self.assertTrue(p.has_rings())
def test_get_stone_white(self): """ Tests making a white player. """ p = Player('w') self.assertEqual('w', p.get_stone())
def test_get_color_white(self): """ Tests to get the long form color of a white player. """ p = Player('w') self.assertEqual('WHITE', p.get_color())