示例#1
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',
                            ''])
示例#2
0
 def test_add_two_children(self):
     node = Raises()
     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)
示例#3
0
 def test_add_two_children(self):
     node = Raises()
     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_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', ''])
示例#5
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',
                            ''])
示例#6
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', ''])
示例#7
0
 def test_render_rst_indent(self):
     node = Raises(indent=5)
     rst = node.render_rst()
     self.assertEqual(rst, ['     :raises:', ''])
示例#8
0
 def test_render_rst_empty(self):
     node = Raises()
     rst = node.render_rst()
     self.assertEqual(rst, [':raises:', ''])
示例#9
0
 def test_add_one_child(self):
     node = Raises()
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)
示例#10
0
 def test_repr(self):
     node = Raises(5)
     actual = repr(node)
     expected = "Raises(5, children=[])"
     self.assertEqual(expected, actual)
示例#11
0
 def test_create_with_indent(self):
     node = Raises(indent=4)
     self.assertEqual(node.indent, 4)
     self.assertEqual(node.lines, [])
     self.assertIsNone(node.parent)
示例#12
0
 def test_create_default_node(self):
     node = Raises()
     self.assertEqual(node.indent, 0)
     self.assertEqual(node.lines, [])
     self.assertIsNone(node.parent)
示例#13
0
 def test_render_rst_indent(self):
     node = Raises(indent=5)
     rst = node.render_rst()
     self.assertEqual(rst, ['     :raises:',
                            ''])
示例#14
0
 def test_render_rst_empty(self):
     node = Raises()
     rst = node.render_rst()
     self.assertEqual(rst, [':raises:',
                            ''])
示例#15
0
 def test_add_one_child(self):
     node = Raises()
     child = Node(parent=node)
     node.add_child(child)
     self.assertIs(node.children[0], child)