コード例 #1
0
ファイル: test_primitive.py プロジェクト: raysect/source
    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
コード例 #2
0
ファイル: test_primitive.py プロジェクト: raysect/source
    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.")
コード例 #3
0
ファイル: test_primitive.py プロジェクト: raysect/source
    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
コード例 #4
0
ファイル: test_primitive.py プロジェクト: raysect/source
    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.")