Ticket #17908: markdown-test-fix-1.3.X.diff

File markdown-test-fix-1.3.X.diff, 1.5 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 6903dd7..96ed857 100644
    a b except ImportError: 
    1414
    1515try:
    1616    import markdown
     17    markdown_vers = getattr(markdown, "version_info", 0)
    1718except ImportError:
    1819    markdown = None
    1920
    Paragraph 2 with a link_ 
    3839
    3940.. _link: http://www.example.com/"""
    4041
    41 
    4242    @unittest.skipUnless(textile, 'texttile not installed')
    4343    def test_textile(self):
    4444        t = Template("{{ textile_content|textile }}")
    Paragraph 2 with a link_ 
    6060        pattern = re.compile("""<p>Paragraph 1\s*</p>\s*<h2>\s*An h2</h2>""")
    6161        self.assertTrue(pattern.match(rendered))
    6262
    63     @unittest.skipUnless(markdown, 'markdown no installed')
     63    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
    6464    def test_markdown_attribute_disable(self):
    6565        t = Template("{% load markup %}{{ markdown_content|markdown:'safe' }}")
    6666        markdown_content = "{@onclick=alert('hi')}some paragraph"
    6767        rendered = t.render(Context({'markdown_content':markdown_content})).strip()
    6868        self.assertTrue('@' in rendered)
    6969
    70     @unittest.skipUnless(markdown, 'markdown no installed')
     70    @unittest.skipUnless(markdown and markdown_vers >= (2,1), 'markdown not installed')
    7171    def test_markdown_attribute_enable(self):
    7272        t = Template("{% load markup %}{{ markdown_content|markdown }}")
    7373        markdown_content = "{@onclick=alert('hi')}some paragraph"
Back to Top