Esempio n. 1
0
    def test_to_xml(self):
        root = TemplateNode()
        node = TemplatePerson2Node()
        root.append(node)
        node.append(TemplateWordNode("Test"))

        xml = root.xml_tree(self.bot, self.clientid)
        self.assertIsNotNone(xml)
        xml_str = ET.tostring(xml, "utf-8").decode("utf-8")
        self.assertEqual("<template><person2>Test</person2></template>", xml_str)
Esempio n. 2
0
    def test_node(self):

        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplatePerson2Node()
        self.assertIsNotNone(node)

        root.append(node)
        self.assertEqual(len(root.children), 1)
Esempio n. 3
0
    def test_node(self):

        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplatePerson2Node()
        self.assertIsNotNone(node)

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

        node.append(TemplateWordNode("me"))
        self.bot.brain.person2s.process_splits(["me","him or her"])

        self.assertEqual(root.resolve(self.bot, self.clientid), "him or her")
Esempio n. 4
0
 def __init__(self):
     TemplatePerson2Node.__init__(self)