Beispiel #1
0
    def test_material_set_invalid(self):
        """Setting an invalid material should raise an exception."""

        n = Primitive()

        with self.assertRaises(TypeError, msg="Attempting to set material with an invalid type (a string) did not raise an exception."):
            n.material = "This should fail!"

        with self.assertRaises(TypeError, msg="Attempting to set material with an invalid type (None) did not raise an exception."):
            n.material = None
Beispiel #2
0
    def test_material(self):
        """Setting and getting material."""

        m = Material()
        n = Primitive()

        n.material = m
        self.assertTrue(n.material is m, "Primitive's material was not correctly set/returned.")
Beispiel #3
0
    def test_material_set_invalid(self):
        """Setting an invalid material should raise an exception."""

        n = Primitive()

        with self.assertRaises(
                TypeError,
                msg=
                "Attempting to set material with an invalid type (a string) did not raise an exception."
        ):
            n.material = "This should fail!"

        with self.assertRaises(
                TypeError,
                msg=
                "Attempting to set material with an invalid type (None) did not raise an exception."
        ):
            n.material = None
Beispiel #4
0
    def test_material(self):
        """Setting and getting material."""

        m = Material()
        n = Primitive()

        n.material = m
        self.assertTrue(
            n.material is m,
            "Primitive's material was not correctly set/returned.")