summaryrefslogtreecommitdiff
path: root/creole/tests/test_cross_compare_textile.py
blob: 63ce6c79121395437fb8973cac5c23ef515ed13e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
#!/usr/bin/env python
# coding: utf-8

"""
    cross compare textile unittest
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Compare all similarities between:
        * textile2html (used the python textile module)
        * html2textile

    Note: This only works fine if there is no problematic whitespace handling.
        In this case, we must test in test_creole2html.py or test_html2creole.py

    :copyleft: 2008-2014 by python-creole team, see AUTHORS for more details.
    :license: GNU GPL v3 or above, see LICENSE for more details.
"""


import unittest

from creole.tests.utils.base_unittest import BaseCreoleTest


class CrossCompareTextileTests(BaseCreoleTest):
    def test_typeface_basic(self):
        self.cross_compare_textile(
            textile_string="""
                _emphasis_
                *strong*
                __italic__
                **bold**
                ??citation??
                -deleted text-
                +inserted text+
                ^superscript^
                ~subscript~
                %span%
                @code@
            """,
            html_string="""
                <p><em>emphasis</em><br />

                <strong>strong</strong><br />

                <i>italic</i><br />

                <b>bold</b><br />

                <cite>citation</cite><br />

                <del>deleted text</del><br />

                <ins>inserted text</ins><br />

                <sup>superscript</sup><br />

                <sub>subscript</sub><br />

                <span>span</span><br />

                <code>code</code></p>
            """
        )

    def test_escape_in_pre(self):
        self.cross_compare_textile(
            textile_string="""
                <pre>
                <html escaped>
                </pre>
            """,
            html_string="""
                <pre>
                &lt;html escaped&gt;
                </pre>
            """)


if __name__ == '__main__':
    unittest.main()