def testShipsOverlappedError(self): with self.assertRaises(ShipsOverLappedError): m = MyGrid() m.placeShipOnGrid(Ship(2,"dest","DE"), Point([1,1]), Point([2,1])) m.placeShipOnGrid(Ship(2,"dest","DE"), Point([1,1]), Point([2,1])) m.placeShipOnGrid(Ship(2,"dest","DE"), Point([3,3]), Point([3,4]))
def testShipIsDiagonalError(self): with self.assertRaises(ShipIsDiagonalError): g = MyGrid() g.placeShipOnGrid(Ship(), Point([0,0]), Point([1,1]))
def testShipPlacementSizeNotSameAsShipSizeError(self): with self.assertRaises(ShipPlacementSizeNotSameAsShipSizeError): g = MyGrid() g.placeShipOnGrid(Ship(),Point([0,0]),Point([0,3]))
def __init__(self, teamName="ATeam"): self.mygrid = MyGrid() self.enemygrid = EnemyGrid() self.fleet = Fleet() self.teamName = teamName