def test_render_rst_with_type(self):
     node = Attribute(5, 'bar')
     node.type = 'str'
     rst = node.render_rst()
     self.assertEqual(rst, ['.. py:attribute:: bar',
                            '',
                            '   (str)',
                            ''])
 def test_render_rst_with_child(self):
     node = Attribute(5, 'bar')
     child = Node(indent=10, lines=["Description"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['.. py:attribute:: bar',
                            '',
                            '   Description',
                            ''])
 def test_render_rst_with_type_and_multi_line_description(self):
     node = Attribute(5, 'bar')
     node.type = 'str'
     child = Node(indent=10, lines=["Description1", "Description2"], parent=node)
     node.add_child(child)
     rst = node.render_rst()
     self.assertEqual(rst, ['.. py:attribute:: bar',
                            '',
                            '   (str) Description1',
                            '   Description2',
                            ''])
 def test_render_rst_with_children(self):
     node = Attribute(5, '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, ['.. py:attribute:: bar',
                            '',
                            '   ChildA',
                            '   ChildB',
                            ''])
 def test_render_rst_empty(self):
     node = Attribute(5, 'bar')
     rst = node.render_rst()
     self.assertEqual(rst, ['.. py:attribute:: bar',
                            ''])