|
| 1 | +""" |
| 2 | +Python Markdown |
| 3 | +
|
| 4 | +A Python implementation of John Gruber's Markdown. |
| 5 | +
|
| 6 | +Documentation: https://python-markdown.github.io/ |
| 7 | +GitHub: https://github.com/Python-Markdown/markdown/ |
| 8 | +PyPI: https://pypi.org/project/Markdown/ |
| 9 | +
|
| 10 | +Started by Manfred Stienstra (http://www.dwerg.net/). |
| 11 | +Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org). |
| 12 | +Currently maintained by Waylan Limberg (https://github.com/waylan), |
| 13 | +Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser). |
| 14 | +
|
| 15 | +Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later) |
| 16 | +Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) |
| 17 | +Copyright 2004 Manfred Stienstra (the original version) |
| 18 | +
|
| 19 | +License: BSD (see LICENSE.md for details). |
| 20 | +""" |
| 21 | + |
| 22 | +from markdown.test_tools import TestCase |
| 23 | + |
| 24 | + |
| 25 | +class TestAutomaticLinks(TestCase): |
| 26 | + |
| 27 | + def test_email_address(self): |
| 28 | + self.assertMarkdownRenders( |
| 29 | + """asdfasdfadsfasd <yuri@freewisdom.org> or you can say """, |
| 30 | + """<p>asdfasdfadsfasd <a href="mailto:yuri@freewisdom.org">yuri@freewisdom.org</a> or you can say </p>""" |
| 31 | + ) |
| 32 | + |
| 33 | + def test_mailto_email_address(self): |
| 34 | + self.assertMarkdownRenders( |
| 35 | + """instead <mailto:yuri@freewisdom.org>""", |
| 36 | + """<p>instead <a href="mailto:yuri@freewisdom.org">yuri@freewisdom.org</a></p>""" |
| 37 | + ) |
| 38 | + |
| 39 | + def test_email_address_with_ampersand(self): |
| 40 | + self.assertMarkdownRenders( |
| 41 | + """<bob&sue@example.com>""", |
| 42 | + """<p><a href="mailto:bob&sue@example.com">bob&sue@example.com</a></p>""" |
| 43 | + ) |
| 44 | + |
| 45 | + def test_invalid_email_address_local_part(self): |
| 46 | + self.assertMarkdownRenders( |
| 47 | + """Missing local-part <@domain>""", |
| 48 | + """<p>Missing local-part <@domain></p>""" |
| 49 | + ) |
| 50 | + |
| 51 | + def test_invalid_email_address_domain(self): |
| 52 | + self.assertMarkdownRenders( |
| 53 | + """Missing domain <local-part@>""", |
| 54 | + """<p>Missing domain <local-part@></p>""" |
| 55 | + ) |
0 commit comments