Example #1
0
    def test_refactor_header(self):
        docstring =\
            """ This is a sample docstring.

My Header
---------
This is just some sample text.
"""

        rst =\
            """ This is a sample docstring.

.. rubric:: My Header

This is just some sample text.
"""
        docstring_lines = docstring.splitlines()
        base_doc = DocRender(docstring_lines)
        base_doc.parse()
        output = '\n'.join(docstring_lines) + '\n'
        self.assertMultiLineEqual(rst, output)
Example #2
0
    def test_render_complex_header(self):
        docstring =\
            """ This is a sample docstring.

Input\\Output header
-------------------

This is just some sample text.
"""

        rst =\
            """ This is a sample docstring.

.. rubric:: Input\\\\Output header

This is just some sample text.
"""
        docstring_lines = docstring.splitlines()
        doc_render = DocRender(docstring_lines)
        doc_render.parse()
        output = '\n'.join(docstring_lines) + '\n'
        self.assertMultiLineEqual(rst, output)