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

        self.h = TimeDetectorXMLHandler()

        self.obj = TimeDetector()

        etree.register_namespace("mc", "http://pymontecarlo.sf.net")
        source = BytesIO(b'<mc:timeDetector xmlns:mc="http://pymontecarlo.sf.net" />')
        self.element = etree.parse(source).getroot()
Esempio n. 2
0
class TestTimeDetectorXMLHandler(unittest.TestCase):
    def setUp(self):
        unittest.TestCase.setUp(self)

        self.h = TimeDetectorXMLHandler()

        self.obj = TimeDetector()

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