def setUp(self): unittest.TestCase.setUp(self) self.h = ShowersStatisticsDetectorXMLHandler() self.obj = ShowersStatisticsDetector() etree.register_namespace("mc", "http://pymontecarlo.sf.net") source = BytesIO(b'<mc:showersStatisticsDetector xmlns:mc="http://pymontecarlo.sf.net" />') self.element = etree.parse(source).getroot()
class TestShowersStatisticsDetectorXMLHandler(unittest.TestCase): def setUp(self): unittest.TestCase.setUp(self) self.h = ShowersStatisticsDetectorXMLHandler() self.obj = ShowersStatisticsDetector() etree.register_namespace("mc", "http://pymontecarlo.sf.net") source = BytesIO(b'<mc:showersStatisticsDetector xmlns:mc="http://pymontecarlo.sf.net" />') self.element = etree.parse(source).getroot() def tearDown(self): unittest.TestCase.tearDown(self) def testcan_parse(self): self.assertTrue(self.h.can_parse(self.element)) def testparse(self): self.h.parse(self.element) def testcan_convert(self): self.assertTrue(self.h.can_convert(self.obj)) def testconvert(self): self.h.convert(self.obj)