예제 #1
0
    def test_to_xml(self):
        root = TemplateNode()
        node = TemplateEvalNode()
        root.append(node)
        node.append(TemplateWordNode("Test"))

        xml = root.xml_tree(self._client_context)
        self.assertIsNotNone(xml)
        xml_str = ET.tostring(xml, "utf-8").decode("utf-8")
        self.assertEqual("<template><eval>Test</eval></template>", xml_str)
예제 #2
0
    def test_node(self):
        root = TemplateNode()
        self.assertIsNotNone(root)

        eval = TemplateEvalNode()
        root.append(eval)

        eval.append(TemplateWordNode("hello"))

        self.assertEqual(len(root.children), 1)

        resolved = root.resolve(self._client_context)
        self.assertIsNotNone(resolved)
        self.assertEqual("hello", resolved)
예제 #3
0
 def __init__(self):
     TemplateEvalNode.__init__(self)