summaryrefslogtreecommitdiff
path: root/creole/tests/test_TODOs.py
blob: c11408920a7fa3a18b7643fb360888a031950bc6 (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
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
"""
    Unittest which failed, cause bugfixes not implemented, yet.
"""

import unittest

from creole.html_tools.strip_html import strip_html
from creole.tests.utils.base_unittest import BaseCreoleTest


class StripHtml(unittest.TestCase):
    @unittest.expectedFailure
    def test_not_closed_image_tag(self):
        output = strip_html('<p>a <img src="/image.jpg"> image.</p>')
        self.assertEqual(output, '<p>a <img src="/image.jpg"> image.</p>')

    @unittest.expectedFailure
    def test_remove_linebreak(self):
        output = strip_html('<strong>foo</strong>\n<ul><li>one</li></ul>')
        self.assertEqual(output, '<strong>foo</strong><ul><li>one</li></ul>')


class CrossCompareCreoleTests(BaseCreoleTest):
    @unittest.expectedFailure
    def test_cross_lines_creole2html(self):
        """ TODO: bold/italics cross lines in creole2html
        see: http://code.google.com/p/python-creole/issues/detail?id=13
        Info: The way html2creole works, see above
        """
        self.cross_compare_creole(
            creole_string=r"""
                Bold and italics should //be
                able// to **cross
                lines.**
            """,
            html_string="""
                <p>Bold and italics should <i>be<br />
                able</i> to <strong>cross<br />
                lines.</strong></p>
            """
        )

    @unittest.expectedFailure
    def test_cross_paragraphs(self):
        """ TODO: bold/italics cross paragraphs in creole2html
        see: http://code.google.com/p/python-creole/issues/detail?id=13
        """
        self.assert_creole2html("""
            But, should //not be...

            ...able// to cross paragraphs.
        """, """
            <p>But, should <em>not be...</em></p>
            <p>...able<em> to cross paragraphs.</em></p>
        """)

    @unittest.expectedFailure
    def test_escape_inline(self):
        """ TODO: different pre/code syntax?
        """
        self.cross_compare_creole(r"""
            this is {{{**escaped** inline}}}, isn't it?

            {{{
            a **code**
            block
            }}}
        """, """
            <p>this is <tt>**escaped** inline</tt>, isn't it?</p>

            <pre>
            a **code**
            block
            </pre>
        """)


class TestHtml2CreoleMarkup(BaseCreoleTest):
    @unittest.expectedFailure
    def test_format_in_a_text(self):
        """ TODO: http://code.google.com/p/python-creole/issues/detail?id=4 """
        self.assert_html2creole(r"""
            **[[/url/|title]]**
        """, """
            <a href="/url/"><strong>title</strong></a>
        """)

    @unittest.expectedFailure
    def test_newline_before_headline(self):
        """ TODO: http://code.google.com/p/python-creole/issues/detail?id=16#c5 """
        self.assert_html2creole(r"""
            **foo**

            = one
        """, """
            <b>foo</b>
            <h1>one</h1>
        """)  # , debug=True)

    @unittest.expectedFailure
    def test_no_space_before_blocktag(self):
        """ TODO: Bug in html2creole.strip_html(): Don't add a space before/after block tags """
        self.assert_html2creole(r"""
            **foo**

            * one
        """, """
            <b>foo</b>
            <ul><li>one</li></ul>
        """  # , debug=True
                                )

    @unittest.expectedFailure
    def test_escape_char(self):
        self.assert_html2creole(r"""
            ~#1
            http://domain.tld/~bar/
            ~http://domain.tld/
            [[Link]]
            ~[[Link]]
        """, """
            <p>#1<br />
            <a href="http://domain.tld/~bar/">http://domain.tld/~bar/</a><br />
            http://domain.tld/<br />
            <a href="Link">Link</a><br />
            [[Link]]</p>
        """)

    @unittest.expectedFailure
    def test_images(self):
        self.assert_html2creole(r"""
            a {{/image.jpg|JPG pictures}} and
            a {{/image.jpeg|JPEG pictures}} and
            a {{/image.gif|GIF pictures}} and
            a {{/image.png|PNG pictures}} !

            picture [[www.domain.tld|{{foo.JPG|Foo}}]] as a link
        """, """
            <p>a <img src="/image.jpg" alt="JPG pictures"> and<br />
            a <img src="/image.jpeg" alt="JPEG pictures"> and<br />
            a <img src="/image.gif" alt="GIF pictures" /> and<br />
            a <img src="/image.png" alt="PNG pictures" /> !</p>

            <p>picture <a href="www.domain.tld"><img src="foo.JPG" alt="Foo"></a> as a link</p>
        """  # , debug=True
                                )