Exemplo n.º 1
0
    def test_dot_none_values(self):
        """
        Test that an exception is raised if one value is None
        :return:
        """
        a = Coordinate((0, 0, None), "XYZ")
        b = Coordinate((1, 2, 3), "XYZ")

        with pytest.raises(TypeError):
            a.dot(b)
Exemplo n.º 2
0
    def test_dot_incompatible_axes(self):
        """
        Test that for incompatible axes the correct exception is raised
        :return:
        """
        a = Coordinate((0, 0, None), "XZ")
        b = Coordinate((1, 2, 3), "XYZ")

        with pytest.raises(TypeError) as excinfo:
            a.dot(b)

        assert str(excinfo.value.args[0]) == "Incompatible axis."
Exemplo n.º 3
0
 def test_dot(self, values_first, values_second, expected):
     """
     Test that the scalar product is calculated correctly
     :param values_first:
     :param values_second:
     :param expected:
     :return:
     """
     a = Coordinate(values_first, "XY")
     b = Coordinate(values_second, "XY")
     assert a.dot(b) == expected