def test_load_from_file_with_classname(self): """Test using shortcut to initialize named XmlObject class from string""" class TestObject(xmlmap.XmlObject): pass obj = xmlmap.load_xmlobject_from_file(self.FILE.name, TestObject) self.assert_(isinstance(obj, TestObject))
def test_load_from_file_with_validation(self): # has doctype, but not valid self.assertRaises(Exception, xmlmap.load_xmlobject_from_file, self.INVALID.name, validate=True) # no doctype self.assertRaises(Exception, xmlmap.load_xmlobject_from_file, self.FILE.name, validate=True) # doctype, valid obj = xmlmap.load_xmlobject_from_file(self.VALID.name, validate=True) self.assert_(isinstance(obj, xmlmap.XmlObject))
def test_load_from_file(self): """Test using shortcut to initialize XmlObject from a file""" obj = xmlmap.load_xmlobject_from_file(self.FILE.name) self.assert_(isinstance(obj, xmlmap.XmlObject))