def test_has_ref_key_auto_bar(self): header = Header(title="Section 1", header_level=1, ref_label="section_1") rst = header.render() compare_with(rst, "rstobj.markup.header.Header.has-ref_key-auto-bar.rst")
def test_with_header(self): ltable = ListTable( data=[["id", "name"], [1, "Alice"], [2, "Bob"]], title="Users", header=True, ) rst = ltable.render() compare_with(rst, "rstobj.directives.table.ListTable.with-header.rst")
def test_with_index(self): ltable = ListTable( data=[["2015-01-01", 100], ["2015-01-02", 105], ["2015-01-03", 97]], title="Price", index=True, header=False, ) rst = ltable.render() compare_with(rst, "rstobj.directives.table.ListTable.with-index.rst")
def test_render(self): cb = CodeBlockEmpty(code=Code(cb_user_class)) rst = cb.render() compare_with( rst, "rstobj.directives.codeblock.CodeBlockEmpty.render.rst") rst = cb.render(indent=1) compare_with( rst, "rstobj.directives.codeblock.CodeBlockEmpty.render-indent.rst")
def test(self): toc = TableOfContent() rst = toc.render() compare_with(rst, "rstobj.directives.toc.TableOfContent.basic.rst") toc = TableOfContent( title="Table of Content", depth=1, backlinks=TableOfContent.BacklinksOptions.top, local=True, ) rst = toc.render() compare_with( rst, "rstobj.directives.toc.TableOfContent.rich-options.rst")
def test(self): image = Image( uri="https://www.python.org/static/img/python-logo.png", width=320, height=320, alt_text="Image Not Found", align=Image.AlignOptions.center, ) rst = image.render() compare_with(rst, "rstobj.directives.image.Image.with-everything.rst") image = Image( uri="https://www.python.org/static/img/python-logo.png", ) rst = image.render() compare_with(rst, "rstobj.directives.image.Image.uri-only.rst")
def test_with_codeblock(self): ltable = ListTable( data=[ ["lang", "example"], ["python2", CodeBlock( code=Code("from __future__ import print_function\n\nprint('Hello World!')"))], ["python3", CodeBlock( code=Code("from __future__ import print_function\n\nprint('Hello World!')"))] ], title="Hello World Examples", index=False, header=True ) rst = ltable.render() compare_with( rst, "rstobj.directives.table.ListTable.with-codeblock.rst") rst = ltable.render(indent=1) compare_with( rst, "rstobj.directives.table.ListTable.with-codeblock-indent.rst")
def test_render_indent(self): image = Image( uri="https://www.python.org/static/img/python-logo.png", ) rst = image.render(indent=1) compare_with(rst, "rstobj.directives.image.Image.render-indent.rst")
def test(self): obj = EnumList(items="a,b,c".split(","), start_num=3) rst = obj.render() compare_with(rst, "rstobj.markup.enum_list.EnumList.render.rst")
def test(self): include = Include(path="README.rst", ) rst = include.render() compare_with(rst, "rstobj.directives.miscellaneous.Include.render.rst")
def test_render(self): cb = CodeBlockPython.from_string(cb_user_class) rst = cb.render() compare_with( rst, "rstobj.directives.codeblock.CodeBlockPython.render.rst")
def test_render_indent(self): code = Code(cb_user_class) rst = code.render(indent=1) compare_with(rst, "rstobj.directives.codeblock.Code.render-indent.rst")
def test_no_ref_key(self): header = Header(title="Section 1", header_level=1) rst = header.render(bar_length=80) compare_with(rst, "rstobj.markup.header.Header.no-ref_key.rst")
def test_auto_label(self): header = Header2(title="Section 2", auto_label=True) rst = header.render() compare_with(rst, "rstobj.markup.header.Header2.auto-ref_key.rst")
def test_no_ref_key_auto_bar(self): header = Header(title="Section 1", header_level=1) rst = header.render() compare_with(rst, "rstobj.markup.header.Header.no-ref_key-auto-bar.rst")
def test(self): obj = BulletList(items="a,b,c".split(",")) rst = obj.render() compare_with(rst, "rstobj.markup.bullet_list.BulletList.render.rst")