示例#1
0
    def test_init(self):
        root = TemplateNode()
        self.assertIsNotNone(root)
        self.assertIsNotNone(root.children)
        self.assertEqual(len(root.children), 0)

        node = TemplateIndexedNode()
        self.assertIsNotNone(node)

        root.append(node)
        self.assertEqual(len(root.children), 1)
示例#2
0
 def __init__(self, index=1):
     TemplateIndexedNode.__init__(self, index)
示例#3
0
 def __init__(self):
     TemplateIndexedNode.__init__(self)
示例#4
0
 def test_invalid_attrib_name(self):
     with self.assertRaises(Exception):
         node = TemplateIndexedNode()
         node.set_attrib('rubbish', 3)
示例#5
0
 def test_attrib_name_index_only(self):
     node = TemplateIndexedNode()
     node.set_attrib('index', 3)
     self.assertEqual(3, node.index)
示例#6
0
 def test_get_set(self):
     node = TemplateIndexedNode()
     node.index = 3
     self.assertEqual(3, node.index)
     node.index = 4
     self.assertEqual(4, node.index)