""" rest2html unittest ~~~~~~~~~~~~~~~~~~ Unittests for rest2html, see: creole/rest2html/clean_writer.py :copyleft: 2011-2012 by python-creole team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ import tempfile import unittest from creole.tests.utils.base_unittest import BaseCreoleTest class ReSt2HtmlTests(BaseCreoleTest): def test_clean_link_table(self): self.assert_rest2html(""" :homepage: http://code.google.com/p/python-creole/ :sourcecode: http://github.com/jedie/python-creole """, """
homepage: | http://code.google.com/p/python-creole/ |
---|---|
sourcecode: | http://github.com/jedie/python-creole |
Headline 1 | Headline 2 |
---|---|
cell one | cell two |
item 1
item 2
numbered list:
Include should be disabled by default.
""", report_level=3) # Set log level to "error" to suppress the waring output def test_include_enabled(self): test_content = "Content from include file." test_content = test_content.encode("utf-8") with tempfile.NamedTemporaryFile() as temp: temp.write(test_content) temp.flush() self.assert_rest2html(""" Enable include and test it. .. include:: %s """ % temp.name, """Enable include and test it.
Content from include file.
""", file_insertion_enabled=True, input_encoding="utf-8") def test_raw_disabled_by_default(self): self.assert_rest2html(""" Raw directive should be disabled by default. .. raw:: htmlRaw directive should be disabled by default.
""", report_level=3) # Set log level to "error" to suppress the waring output def test_raw_enabled(self): self.assert_rest2html(""" Now RAW is enabled. .. raw:: htmlNow RAW is enabled.
Image alignment should be preserved.
""") def test_preserve_figure_alignment(self): self.assert_rest2html(""" Image alignment should be preserved. .. figure:: bar.png :align: right """, """Image alignment should be preserved.
""") if __name__ == '__main__': unittest.main()