aboutsummaryrefslogtreecommitdiff
path: root/tests/test_syntax/extensions/test_abbr.py
diff options
context:
space:
mode:
authorSadaf Ebrahimi <sadafebrahimi@google.com>2022-11-07 17:06:45 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2022-11-07 17:06:45 +0000
commitb8ef043a4bce3c0e0c3a83a5309c17d1962be972 (patch)
tree1a110fa9fa982e746b1969458c5b9d373c70a38c /tests/test_syntax/extensions/test_abbr.py
parentf9792ce11873633749589df798950d128385a987 (diff)
parent41abd7141734af7b464f24a52d0405e0a0ebe63c (diff)
downloadmarkdown-master.tar.gz
Original change: https://android-review.googlesource.com/c/platform/external/markdown/+/2288233 Change-Id: Ieca29d1e12802f580116844c0b5f1770313569c0 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
Diffstat (limited to 'tests/test_syntax/extensions/test_abbr.py')
-rw-r--r--tests/test_syntax/extensions/test_abbr.py242
1 files changed, 242 insertions, 0 deletions
diff --git a/tests/test_syntax/extensions/test_abbr.py b/tests/test_syntax/extensions/test_abbr.py
new file mode 100644
index 0000000..64388c2
--- /dev/null
+++ b/tests/test_syntax/extensions/test_abbr.py
@@ -0,0 +1,242 @@
+# -*- coding: utf-8 -*-
+"""
+Python Markdown
+
+A Python implementation of John Gruber's Markdown.
+
+Documentation: https://python-markdown.github.io/
+GitHub: https://github.com/Python-Markdown/markdown/
+PyPI: https://pypi.org/project/Markdown/
+
+Started by Manfred Stienstra (http://www.dwerg.net/).
+Maintained for a few years by Yuri Takhteyev (http://www.freewisdom.org).
+Currently maintained by Waylan Limberg (https://github.com/waylan),
+Dmitry Shachnev (https://github.com/mitya57) and Isaac Muse (https://github.com/facelessuser).
+
+Copyright 2007-2018 The Python Markdown Project (v. 1.7 and later)
+Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b)
+Copyright 2004 Manfred Stienstra (the original version)
+
+License: BSD (see LICENSE.md for details).
+"""
+
+from markdown.test_tools import TestCase
+
+
+class TestAbbr(TestCase):
+
+ default_kwargs = {'extensions': ['abbr']}
+
+ def test_abbr_upper(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]: Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_lower(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ abbr
+
+ *[abbr]: Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">abbr</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_multiple(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ The HTML specification
+ is maintained by the W3C.
+
+ *[HTML]: Hyper Text Markup Language
+ *[W3C]: World Wide Web Consortium
+ """
+ ),
+ self.dedent(
+ """
+ <p>The <abbr title="Hyper Text Markup Language">HTML</abbr> specification
+ is maintained by the <abbr title="World Wide Web Consortium">W3C</abbr>.</p>
+ """
+ )
+ )
+
+ def test_abbr_override(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]: Ignored
+ *[ABBR]: The override
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="The override">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_no_blank_Lines(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+ *[ABBR]: Abbreviation
+ ABBR
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_no_space(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]:Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_extra_space(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR] : Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_line_break(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]:
+ Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_ignore_unmatched_case(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR abbr
+
+ *[ABBR]: Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr> abbr</p>
+ """
+ )
+ )
+
+ def test_abbr_partial_word(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR ABBREVIATION
+
+ *[ABBR]: Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="Abbreviation">ABBR</abbr> ABBREVIATION</p>
+ """
+ )
+ )
+
+ def test_abbr_unused(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ foo bar
+
+ *[ABBR]: Abbreviation
+ """
+ ),
+ self.dedent(
+ """
+ <p>foo bar</p>
+ """
+ )
+ )
+
+ def test_abbr_double_quoted(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]: "Abbreviation"
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="&quot;Abbreviation&quot;">ABBR</abbr></p>
+ """
+ )
+ )
+
+ def test_abbr_single_quoted(self):
+ self.assertMarkdownRenders(
+ self.dedent(
+ """
+ ABBR
+
+ *[ABBR]: 'Abbreviation'
+ """
+ ),
+ self.dedent(
+ """
+ <p><abbr title="'Abbreviation'">ABBR</abbr></p>
+ """
+ )
+ )