def setUp(self): unittest.TestCase.setUp(self) self.h = _GeometryXMLHandler() self.obj = _Geometry(1.1, 2.2) etree.register_namespace('mc', 'http://pymontecarlo.sf.net') source = BytesIO(b'<mc:_geometry xmlns:mc="http://pymontecarlo.sf.net" rotation="2.2" tilt="1.1" />') self.element = etree.parse(source).getroot()
def parse(self, element): tilt_rad = self._parse_numerical_parameter(element, 'tilt') rotation_rad = self._parse_numerical_parameter(element, 'rotation') return _Geometry(tilt_rad, rotation_rad)