Ticket #17908: markdown-test-fix.diff

File markdown-test-fix.diff, 1.6 KB (added by ptone, 3 years ago)
  • django/contrib/markup/tests.py

    diff --git a/django/contrib/markup/tests.py b/django/contrib/markup/tests.py
    index 4539657..ab1332a 100644
    a b except ImportError: 
    1212
    1313try:
    1414    import markdown
     15    markdown_vers = getattr(markdown, "version_info", 0)
    1516except ImportError:
    1617    markdown = None
    1718
    Paragraph 2 with a link_ 
    3637
    3738.. _link: http://www.example.com/"""
    3839
    39 
    4040    @unittest.skipUnless(textile, 'texttile not installed')
    4141    def test_textile(self):
    4242        t = Template("{% load markup %}{{ textile_content|textile }}")
    Paragraph 2 with a link_ 
    5858        pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""")
    5959        self.assertTrue(pattern.match(rendered))
    6060
    61     @unittest.skipUnless(markdown, 'markdown no installed')
     61    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
    6262    def test_markdown_attribute_disable(self):
    6363        t = Template("{% load markup %}{{ markdown_content|markdown:'safe' }}")
    6464        markdown_content = "{@onclick=alert('hi')}some paragraph"
    6565        rendered = t.render(Context({'markdown_content':markdown_content})).strip()
    6666        self.assertTrue('@' in rendered)
    6767
    68     @unittest.skipUnless(markdown, 'markdown no installed')
     68    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
    6969    def test_markdown_attribute_enable(self):
    7070        t = Template("{% load markup %}{{ markdown_content|markdown }}")
    7171        markdown_content = "{@onclick=alert('hi')}some paragraph"
Back to Top