Example #1
0
    def test_to_xml(self):
        root = TemplateNode()
        node = TemplateGenderNode()
        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><gender>Test</gender></template>", xml_str)
Example #2
0
    def test_to_xml(self):
        root = TemplateNode()
        node = TemplateGenderNode()
        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><gender>Test</gender></template>", xml_str)
Example #3
0
    def test_node(self):
        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateGenderNode()
        self.assertIsNotNone(node)

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

        node.append(TemplateWordNode("to him"))
Example #4
0
    def test_node(self):
        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateGenderNode()
        self.assertIsNotNone(node)

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

        node.append(TemplateWordNode("to him"))
        self.bot.brain.genders.process_splits(["to him","to her"])

        self.assertEqual(root.resolve(self.bot, self.clientid), "to her")
Example #5
0
    def test_node(self):
        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateGenderNode()
        self.assertIsNotNone(node)

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

        node.append(TemplateWordNode("to him"))
        self.bot.brain.genders.process_splits(["to him", "to her"])

        self.assertEqual(root.resolve(self.bot, self.clientid), "to her")
Example #6
0
 def __init__(self):
     TemplateGenderNode.__init__(self)
Example #7
0
 def __init__(self):
     TemplateGenderNode.__init__(self)