Ejemplo n.º 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'])
Ejemplo n.º 2
0
 def test_render_rst_indented_lines(self):
     node = Node(indent=3, lines= ['First',
                                   'Second',
                                   'Third'])
     rst = node.render_rst()
     self.assertEqual(rst, ['   First',
                            '   Second',
                            '   Third'])
Ejemplo n.º 3
0
 def test_add_two_children(self):
     node = Except(5, 'FooError')
     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)
Ejemplo n.º 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)
Ejemplo n.º 5
0
 def test_render_rst_indented_lines(self):
     node = Node(indent=3, lines= ['First',
                                   'Second',
                                   'Third'])
     rst = node.render_rst()
     self.assertEqual(rst, ['   First',
                            '   Second',
                            '   Third'])
Ejemplo n.º 6
0
 def test_add_two_children(self):
     node = Note(5)
     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)
Ejemplo n.º 7
0
 def test_render_rst_with_children(self):
     node = Arg(5, 10, 'bar')
     child_a = Node(indent=10, lines=["ChildA"], parent=node)
     node.add_child(child_a)
     child_b = Node(indent=10, lines=["ChildB"], parent=node)
     node.add_child(child_b)
     rst = node.render_rst()
     self.assertEqual(rst, ['     :param bar: ChildA', '     ChildB', ''])
Ejemplo n.º 8
0
 def test_render_rst_with_children(self):
     node = Raises(5)
     child_a = Node(indent=10, lines=["ChildA"], parent=node)
     node.add_child(child_a)
     child_b = Node(indent=10, lines=["ChildB"], parent=node)
     node.add_child(child_b)
     rst = node.render_rst()
     self.assertEqual(
         rst, ['     :raises:', '          ChildA', '          ChildB', ''])
Ejemplo n.º 9
0
 def test_render_rst_with_children(self):
     node = Except(5, 'FooError')
     child_a = Node(indent=10, lines=["ChildA"], parent=node)
     node.add_child(child_a)
     child_b = Node(indent=10, lines=["ChildB"], parent=node)
     node.add_child(child_b)
     rst = node.render_rst()
     self.assertEqual(rst,
                      ['     * FooError - ChildA', '          ChildB', ''])
Ejemplo n.º 10
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'])
Ejemplo n.º 11
0
 def test_render_rst_with_child(self):
     node = Except(5, 'FooError')
     child = Node(indent=10, lines=["Description"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['     * FooError - Description',
                            ''])
Ejemplo n.º 12
0
 def test_render_rst_with_child(self):
     node = Arg(5, 10, 'bar')
     child = Node(indent=10, lines=["Description"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['     :param bar: Description',
                            ''])
Ejemplo n.º 13
0
 def test_render_rst_with_child(self):
     node = Raises(5)
     child = Node(indent=10, lines=["Description"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['     :raises:',
                            '          Description',
                            ''])
Ejemplo n.º 14
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'])
Ejemplo n.º 15
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'])
Ejemplo n.º 16
0
 def test_add_one_child(self):
     node = Note(5)
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
Ejemplo n.º 17
0
 def test_create_with_indent(self):
     node = Node(indent=4)
     self.assertEqual(node.indent, 4)
     self.assertEqual(node.lines, [])
     self.assertIsNone(node.parent)
Ejemplo n.º 18
0
 def test_add_one_child(self):
     node = Arg(5, 10, 'foo')
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
Ejemplo n.º 19
0
 def test_render_rst_empty(self):
     node = Node()
     rst = node.render_rst()
     self.assertEqual(len(rst), 0)
Ejemplo n.º 20
0
 def test_render_rst_indent(self):
     node = Node(indent=4)
     rst = node.render_rst()
     self.assertEqual(len(rst), 0)
Ejemplo n.º 21
0
 def test_add_one_child(self):
     node = Node()
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
Ejemplo n.º 22
0
 def test_create_with_lines(self):
     node = Node(lines= ['First', 'Second', 'Third'])
     self.assertEqual(node.indent, 0)
     self.assertEqual(node.lines, ['First', 'Second', 'Third'])
     self.assertIsNone(node.parent)
Ejemplo n.º 23
0
 def test_add_one_child(self):
     node = Except(5, 'FooError')
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
Ejemplo n.º 24
0
 def test_create_default_node(self):
     node = Node()
     self.assertEqual(node.indent, 0)
     self.assertEqual(node.lines, [])
     self.assertIsNone(node.parent)
Ejemplo n.º 25
0
 def test_repr(self):
     node = Node(5, ['One', 'Two', 'Three'])
     actual = repr(node)
     expected = "Node(5, ['One', 'Two', 'Three'], children=[])"
     self.assertEqual(expected, actual)
Ejemplo n.º 26
0
 def test_render_rst_indent(self):
     node = Node(indent=4)
     rst = node.render_rst()
     self.assertEqual(len(rst), 0)
Ejemplo n.º 27
0
 def test_render_rst_empty(self):
     node = Node()
     rst = node.render_rst()
     self.assertEqual(len(rst), 0)