aboutsummaryrefslogtreecommitdiffstats
path: root/djangorestframework/tests/description.py
diff options
context:
space:
mode:
authorMarko Tibold2011-12-21 01:06:24 +0100
committerMarko Tibold2011-12-21 01:06:24 +0100
commit90ddec03b7e6c3236d44eafe1a3c17db7a662780 (patch)
treec6ee9239f6afdee3eb697edece94dc923eb0c869 /djangorestframework/tests/description.py
parent1c8b40fb5f4744bc0bfa4448075eeed193ab950c (diff)
downloaddjango-rest-framework-90ddec03b7e6c3236d44eafe1a3c17db7a662780.tar.bz2
Fixes #94
Modified alazaro's commit sot that both markdown < 2.1 and >= 2.1 are supported The test checks if either matches the old or the new style.
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)