Пример #1
0
 def test_render_rst_with_child(self):
     node = Node(indent=4, lines=["Parent"])
     child = Node(indent=8, lines=["Child"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['    Parent',
                            '        Child'])
Пример #2
0
 def test_render_rst_with_children(self):
     node = Node(indent=4, lines=["Parent"])
     child_a = Node(indent=8, lines=["ChildA"], parent=node)
     node.add_child(child_a)
     child_b = Node(indent=6, lines=["ChildB"], parent=node)
     node.add_child(child_b)
     rst = node.render_rst()
     self.assertEqual(rst, ['    Parent', '        ChildA', '      ChildB'])
Пример #3
0
 def test_add_two_children(self):
     node = Node()
     child0 = Node(parent=node)
     child1 = Node(parent=node)
     node.add_child(child0)
     node.add_child(child1)
     self.assertIs(node.children[0], child0)
     self.assertIs(node.children[1], child1)
Пример #4
0
 def test_add_two_children(self):
     node = Node()
     child0 = Node(parent=node)
     child1 = Node(parent=node)
     node.add_child(child0)
     node.add_child(child1)
     self.assertIs(node.children[0], child0)
     self.assertIs(node.children[1], child1)
Пример #5
0
 def test_render_rst_with_children(self):
     node = Node(indent=4, lines=["Parent"])
     child_a = Node(indent=8, lines=["ChildA"], parent=node)
     node.add_child(child_a)
     child_b = Node(indent=6, lines=["ChildB"], parent=node)
     node.add_child(child_b)
     rst = node.render_rst()
     self.assertEqual(rst, ['    Parent',
                            '        ChildA',
                            '      ChildB'])
Пример #6
0
 def test_render_rst_with_child(self):
     node = Node(indent=4, lines=["Parent"])
     child = Node(indent=8, lines=["Child"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['    Parent', '        Child'])
Пример #7
0
 def test_add_one_child(self):
     node = Node()
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
Пример #8
0
 def test_add_one_child(self):
     node = Node()
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)