aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/description.py
diff options
context:
space:
mode:
Diffstat (limited to 'djangorestframework/tests/description.py')
-rw-r--r--djangorestframework/tests/description.py22
1 files changed, 19 insertions, 3 deletions
diff --git a/djangorestframework/tests/description.py b/djangorestframework/tests/description.py
index 17bb4330..c0424c24 100644
--- a/djangorestframework/tests/description.py
+++ b/djangorestframework/tests/description.py
@@ -19,8 +19,22 @@ indented
# hash style header #"""
-# If markdown is installed we also test it's working (and that our wrapped forces '=' to h2 and '-' to h3)
-MARKED_DOWN = """<h2 id="an-example-docstring">an example docstring</h2>
+# If markdown is installed we also test it's working
+# (and that our wrapped forces '=' to h2 and '-' to h3)
+
+# We support markdown < 2.1 and markdown >= 2.1
+MARKED_DOWN_lt_21 = """<h2>an example docstring</h2>
+<ul>
+<li>list</li>
+<li>list</li>
+</ul>
+<h3>another header</h3>
+<pre><code>code block
+</code></pre>
+<p>indented</p>
+<h2 id="hash_style_header">hash style header</h2>"""
+
+MARKED_DOWN_gte_21 = """<h2 id="an-example-docstring">an example docstring</h2>
<ul>
<li>list</li>
<li>list</li>
@@ -92,4 +106,6 @@ class TestViewNamesAndDescriptions(TestCase):
def test_markdown(self):
"""Ensure markdown to HTML works as expected"""
if apply_markdown:
- self.assertEquals(apply_markdown(DESCRIPTION), MARKED_DOWN)
+ gte_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_gte_21
+ lt_21_match = apply_markdown(DESCRIPTION) == MARKED_DOWN_lt_21
+ self.assertTrue(gte_21_match or lt_21_match)