def test_elephant_capture(self): """ 1. Mouse/rat 8. Elephant The exception is rax x elephant: the elephant can't capture the mouse and the mouse can capture the elephant """ player1 = MockPlayer() player2 = MockPlayer() piece1 = Piece(player1, Piece.MOUSE) piece8 = Piece(player2, 8) self.failIf(piece8.can_catch(piece1)) self.assertTrue(piece1.can_catch(piece8))
def test_trap_capture(self): """ If a piece are in a trap, your value is 0 and it can be captured by any other piece """ player1 = MockPlayer() player2 = MockPlayer() piece1 = Piece(player1, Piece.MOUSE) piece2 = Piece(player2, 2) piece2.trap() self.assertTrue(piece1.can_catch(piece2)) piece2.release() self.failIf(piece1.can_catch(piece2))
def test_capture(self): """ 1. Mouse/rat 2. Cat A catch is allowed to less or equal value. A cat can catch a mouse, but a mouse can't catch a cat """ player1 = MockPlayer() player2 = MockPlayer() piece1 = Piece(player1, Piece.MOUSE) piece2 = Piece(player2, 2) self.failIf(piece1.can_catch(piece2)) self.assertTrue(piece2.can_catch(piece1)) piece2 = Piece(player2, Piece.MOUSE) self.assertTrue(piece2.can_catch(piece1)) self.assertTrue(piece1.can_catch(piece2))