def test_init(self): gameboard = GameBoard.GameBoard(size=(200., 150.), no_asteroids=12) self.assertTrue(hasattr(gameboard, '_asteroids')) self.assertTrue(hasattr(gameboard, 'moving_objects')) self.assertTrue(hasattr(gameboard, '_ship')) self.assertTrue(hasattr(gameboard, '_projectiles')) self.assertTrue(hasattr(gameboard, 'gameover'))
def setUp(self): self.gameboard = GameBoard.GameBoard(size=(100., 100.), no_asteroids=2)
def test_init_wrong_size_argument2(self): with self.assertRaises(AttributeError): gameboard = GameBoard.GameBoard(size="Sven", no_asteroids=10)
def test_init_wrong_no_asteroids_arguemnts(self): with self.assertRaises(AttributeError): gameboard = GameBoard.GameBoard(size=(100., 120.), no_asteroids=10.2)
def test_init_wrong_size_argument(self): with self.assertRaises(AttributeError): gameboard = GameBoard.GameBoard(size=(200., 150., 300.), no_asteroids=10)
def setUp(self): self.gameboard = GameBoard.GameBoard(size=(100., 100.), no_asteroids=2) self.ship = GamePiece.Ship(1., (10., 10., 0.)) self.Asteroid = GamePiece.Asteroid1(1., (20., 10., 0), (0., 0.), 1.)
def test_init_arguments(self): gameboard = GameBoard.GameBoard(size=(200., 150.), no_asteroids=12) self.assertSequenceEqual(gameboard.size, (200., 150.)) self.assertEqual(gameboard.no_asteroids, 12)