Mercurial > p > roundup > code
comparison test/test_templating.py @ 6109:b108c9fc7aea
fix test for Python 2
| author | Christof Meerwald <cmeerw@cmeerw.org> |
|---|---|
| date | Fri, 28 Feb 2020 08:15:51 +0000 |
| parents | a1fd9551d416 |
| children | 474de62f4ce0 |
comparison
equal
deleted
inserted
replaced
| 6108:240d78d23f92 | 6109:b108c9fc7aea |
|---|---|
| 427 def test_string_markdown_link(self): | 427 def test_string_markdown_link(self): |
| 428 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A link <http://localhost>')) | 428 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A link <http://localhost>')) |
| 429 self.assertEqual(p.markdown().strip(), u2s(u'<p>A link <a href="http://localhost">http://localhost</a></p>')) | 429 self.assertEqual(p.markdown().strip(), u2s(u'<p>A link <a href="http://localhost">http://localhost</a></p>')) |
| 430 | 430 |
| 431 def test_string_markdown_link(self): | 431 def test_string_markdown_link(self): |
| 432 # markdown2 and markdown | 432 # markdown2 and markdown escape the email address |
| 433 try: | 433 try: |
| 434 import html | 434 from html import unescape as html_unescape |
| 435 html_unescape = html.unescape | 435 except ImportError: |
| 436 except AttributeError: | |
| 437 from HTMLParser import HTMLParser | 436 from HTMLParser import HTMLParser |
| 438 html_unescape = HTMLParser().unescape | 437 html_unescape = HTMLParser().unescape |
| 439 | 438 |
| 440 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A link <cmeerw@example.com>')) | 439 p = StringHTMLProperty(self.client, 'test', '1', None, 'test', u2s(u'A link <cmeerw@example.com>')) |
| 441 self.assertEqual(html_unescape(p.markdown().strip()), u2s(u'<p>A link <a href="mailto:cmeerw@example.com">cmeerw@example.com</a></p>')) | 440 self.assertEqual(html_unescape(p.markdown().strip()), u2s(u'<p>A link <a href="mailto:cmeerw@example.com">cmeerw@example.com</a></p>')) |
