| 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-2021 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 <[email protected]> or you can say ', |
| 30 |
'<p>asdfasdfadsfasd <a href="mailto:yur' |
| 31 |
'i@freewisdom.or' |
| 32 |
'g">yuri@freewisd' |
| 33 |
'om.org</a> or you can say </p>' |
| 34 |
) |
| 35 |
|
| 36 |
def test_mailto_email_address(self): |
| 37 |
self.assertMarkdownRenders( |
| 38 |
'instead <mailto:[email protected]>', |
| 39 |
'<p>instead <a href="mailto:yuri@' |
| 40 |
'freewisdom.org">' |
| 41 |
'yuri@freewisdom' |
| 42 |
'.org</a></p>' |
| 43 |
) |
| 44 |
|
| 45 |
def test_email_address_with_ampersand(self): |
| 46 |
self.assertMarkdownRenders( |
| 47 |
'<bob&[email protected]>', |
| 48 |
'<p><a href="mailto:bob&sue' |
| 49 |
'@example.com">bob&' |
| 50 |
'sue@example.com</a></p>' |
| 51 |
) |
| 52 |
|
| 53 |
def test_invalid_email_address_local_part(self): |
| 54 |
self.assertMarkdownRenders( |
| 55 |
'Missing local-part <@domain>', |
| 56 |
'<p>Missing local-part <@domain></p>' |
| 57 |
) |
| 58 |
|
| 59 |
def test_invalid_email_address_domain(self): |
| 60 |
self.assertMarkdownRenders( |
| 61 |
'Missing domain <local-part@>', |
| 62 |
'<p>Missing domain <local-part@></p>' |
| 63 |
) |