def test_set_unkonw_value(self): f = Field(5, 5) f.set(2, 2, 'ship') self.assertTrue(f.get(2, 2).is_ship) with self.assertRaises(UnknownCellValue): f.set(1, 1, 'unknown')
def test_income_shoot_missed(self): f = Field(4, 4) cell = f.get(2, 2) self.assertFalse(ShipService.shoot_to(f, 2, 2)) self.assertTrue(cell.is_shooted) self.assertTrue(cell.is_empty)
def test_get(self): f = Field(5, 5) cell = f.get(3, 3) self.assertEqual(cell.x, 3) self.assertEqual(cell.y, 3)