def test_Cycle(self): """ Verify that a MaterialX file with an inherits cycle fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString('''<?xml version="1.0" ?> <materialx version="1.35"> <nodedef name="n1" type="float" node="test" inherit="n2"> <nodedef name="n2" type="float" node="test" inherit="n1"> </materialx> ''')
def test_DuplicateName(self): """ Verify that a MaterialX file with duplicate element names fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString('''<?xml version="1.0" ?> <materialx version="1.35"> <typedef name="type1"> <typedef name="type1"> </materialx> ''')
def test_Cycle(self): """ Verify that a MaterialX file with an inherits cycle fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString( '''<?xml version="1.0" ?> <materialx version="1.35"> <nodedef name="n1" type="float" node="test" inherit="n2"> <nodedef name="n2" type="float" node="test" inherit="n1"> </materialx> ''')
def test_DuplicateName(self): """ Verify that a MaterialX file with duplicate element names fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString( '''<?xml version="1.0" ?> <materialx version="1.35"> <typedef name="type1"> <typedef name="type1"> </materialx> ''')
def test_EmptyMaterialXDocument(self): """ Verify that a file with an empty a materialx element is okay. """ stage = UsdMtlx._TestString('''<?xml version="1.0" ?> <materialx version="1.35"> </materialx> ''') self.assertEqual(stage.GetRootLayer().ExportToString(), _EmptyLayer())
def test_EmptyMaterialXDocument(self): """ Verify that a file with an empty a materialx element is okay. """ stage = UsdMtlx._TestString( '''<?xml version="1.0" ?> <materialx version="1.35"> </materialx> ''') self.assertEqual(stage.GetRootLayer().ExportToString(), _EmptyLayer())
def test_EmptyXMLDocument(self): """ Verify that a MaterialX file with only an XML header fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString('''<?xml version="1.0" ?>''')
def test_BadMagic(self): """ Verify that a MaterialX file with a bad XML header fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString('''<?not_xml version="1.0" ?>''')
def test_EmptyFile(self): """ Verify that an empty MaterialX document fails. """ with self.assertRaises(Tf.ErrorException) as e: UsdMtlx._TestString('')