Esempio n. 1
0
    def test_init(self):
        # Arrange
        name = 'NShip'
        type_ = 'Battle'
        align = Alignment.us
        x_location = 2
        y_location = 2

        # Act
        ship = Ship(name, type_, x_location, y_location, align)
        print(ship.status())

        # Assert
        self.assertEqual(name, ship._name)
        self.assertEqual(type_, ship._type)
        self.assertEqual(align, ship._align)
        self.assertEqual(x_location, ship._x_location)
        self.assertEqual(y_location, ship._y_location)
Esempio n. 2
0
    def test_status(self):
        # Arrange
        name = 'NShip'
        type_ = 'Battle'
        align = Alignment.us
        x_location = 2
        y_location = 4

        # Act
        ship = Ship(name, type_, x_location, y_location, align)
        result = ship.status()
        print(result)

        # Assert
        self.assertEqual(
            str("Ship name: {},Ship type: {}, Current health: {},"
                " Location ({},{}) ").format(name, type_, 0, x_location,
                                             y_location), result)