Пример #1
0
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.h = ElectronFractionDetectorXMLHandler()

        self.obj = ElectronFractionDetector()

        etree.register_namespace("mc", "http://pymontecarlo.sf.net")
        source = BytesIO(b'<mc:electronFractionDetector xmlns:mc="http://pymontecarlo.sf.net" />')
        self.element = etree.parse(source).getroot()
Пример #2
0
class TestElectronFractionDetectorXMLHandler(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.h = ElectronFractionDetectorXMLHandler()

        self.obj = ElectronFractionDetector()

        etree.register_namespace("mc", "http://pymontecarlo.sf.net")
        source = BytesIO(b'<mc:electronFractionDetector 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)