Code

Ticket #17908: markdown-test-fix.diff

File markdown-test-fix.diff, 1.6 KB (added by ptone, 2 years ago)
Line 
1diff --git a/django/contrib/markup/tests.py b/django/contrib/markup/tests.py
2index 4539657..ab1332a 100644
3--- a/django/contrib/markup/tests.py
4+++ b/django/contrib/markup/tests.py
5@@ -12,6 +12,7 @@ except ImportError:
6 
7 try:
8     import markdown
9+    markdown_vers = getattr(markdown, "version_info", 0)
10 except ImportError:
11     markdown = None
12 
13@@ -36,7 +37,6 @@ Paragraph 2 with a link_
14 
15 .. _link: http://www.example.com/"""
16 
17-
18     @unittest.skipUnless(textile, 'texttile not installed')
19     def test_textile(self):
20         t = Template("{% load markup %}{{ textile_content|textile }}")
21@@ -58,14 +58,14 @@ Paragraph 2 with a link_
22         pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""")
23         self.assertTrue(pattern.match(rendered))
24 
25-    @unittest.skipUnless(markdown, 'markdown no installed')
26+    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
27     def test_markdown_attribute_disable(self):
28         t = Template("{% load markup %}{{ markdown_content|markdown:'safe' }}")
29         markdown_content = "{@onclick=alert('hi')}some paragraph"
30         rendered = t.render(Context({'markdown_content':markdown_content})).strip()
31         self.assertTrue('@' in rendered)
32 
33-    @unittest.skipUnless(markdown, 'markdown no installed')
34+    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
35     def test_markdown_attribute_enable(self):
36         t = Template("{% load markup %}{{ markdown_content|markdown }}")
37         markdown_content = "{@onclick=alert('hi')}some paragraph"