""" html2textile unittest ~~~~~~~~~~~~~~~~~~~~~ Unittests for special cases which only works in the html2textile way. Note: This only works fine if there is no problematic whitespace handling. :copyleft: 2011 by python-creole team, see AUTHORS for more details. :license: GNU GPL v3 or above, see LICENSE for more details. """ import unittest from creole.shared.unknown_tags import preformat_unknown_nodes from creole.tests.utils.base_unittest import BaseCreoleTest class TextileTests(BaseCreoleTest): def test_entities(self): """ can't be cross tested, because textile would convert < to < and > to > """ self.assert_html2textile( textile_string=""" less-than sign: < greater-than sign: > """, html_string="""
less-than sign: <
greater-than sign: >
area.
"""
self.assert_html2textile(
textile_string="""
111 <><
>foo<><
> 222
333<><
>foobar<><
>444
555<> <
>666
""",
html_string="""
111 foo 222
333foobar 444
555 666
""",
unknown_emit=preformat_unknown_nodes
)
def test_transparent_unknown_nodes(self):
"""
transparent_unknown_nodes is the default unknown_emit:
Remove all unknown html tags and show only
their child nodes' content.
"""
self.assert_html2textile(
textile_string="""
111 foo 222
333foobar444
555666
""",
html_string="""
111 foo 222
333foobar 444
555 666
""",
)
if __name__ == '__main__':
unittest.main()