Esempio n. 1
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.h = _ModelXMLHandler()

        self.obj1 = _Model(MTYPE, 'name1', 'ref1')
        self.obj2 = _Model(MTYPE, 'name2')

        etree.register_namespace('mc', 'http://pymontecarlo.sf.net')
        source = BytesIO(b'<mc:_model xmlns:mc="http://pymontecarlo.sf.net" name="name1" type="type1" reference="ref1" />')
        self.element1 = etree.parse(source).getroot()

        source = BytesIO(b'<mc:_model xmlns:mc="http://pymontecarlo.sf.net" name="name2" type="type1" />')
        self.element2 = etree.parse(source).getroot()
Esempio n. 2
0
 def parse(self, element):
     name = element.get('name')
     type_ = ModelType(element.get('type'))
     reference = element.get('reference', '')
     return _Model(type_, name, reference)