mirror of
https://github.com/encode/django-rest-framework.git
synced 2024-11-22 09:36:49 +03:00
Update docstring test for more recent pygments version (#8530)
* Update docstring test for more recent pygments version * Drop unused import
This commit is contained in:
parent
2506d0b4f2
commit
fa9d516ee2
|
@ -3,8 +3,7 @@ coreapi==2.3.1
|
||||||
coreschema==0.0.4
|
coreschema==0.0.4
|
||||||
django-filter>=2.4.0,<3.0
|
django-filter>=2.4.0,<3.0
|
||||||
django-guardian>=2.4.0,<2.5
|
django-guardian>=2.4.0,<2.5
|
||||||
markdown==3.3;python_version>="3.6"
|
markdown==3.3
|
||||||
markdown==3.2.2;python_version=="3.5"
|
|
||||||
psycopg2-binary>=2.8.5,<2.9
|
psycopg2-binary>=2.8.5,<2.9
|
||||||
pygments>=2.7.1,<2.8
|
pygments==2.12
|
||||||
pyyaml>=5.3.1,<5.4
|
pyyaml>=5.3.1,<5.4
|
||||||
|
|
|
@ -1,5 +1,3 @@
|
||||||
import sys
|
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
from django.test import TestCase
|
from django.test import TestCase
|
||||||
|
|
||||||
|
@ -33,7 +31,7 @@ indented
|
||||||
|
|
||||||
# If markdown is installed we also test it's working
|
# If markdown is installed we also test it's working
|
||||||
# (and that our wrapped forces '=' to h2 and '-' to h3)
|
# (and that our wrapped forces '=' to h2 and '-' to h3)
|
||||||
MARKDOWN_BASE = """<h2 id="an-example-docstring">an example docstring</h2>
|
MARKDOWN_DOCSTRING = """<h2 id="an-example-docstring">an example docstring</h2>
|
||||||
<ul>
|
<ul>
|
||||||
<li>list</li>
|
<li>list</li>
|
||||||
<li>list</li>
|
<li>list</li>
|
||||||
|
@ -42,25 +40,8 @@ MARKDOWN_BASE = """<h2 id="an-example-docstring">an example docstring</h2>
|
||||||
<pre><code>code block
|
<pre><code>code block
|
||||||
</code></pre>
|
</code></pre>
|
||||||
<p>indented</p>
|
<p>indented</p>
|
||||||
<h2 id="hash-style-header">hash style header</h2>%s"""
|
<h2 id="hash-style-header">hash style header</h2>
|
||||||
|
<div class="highlight"><pre><span></span><span class="p">[{</span><span class="w"></span><br /><span class="w"> </span><span class="nt">"alpha"</span><span class="p">:</span><span class="w"> </span><span class="mi">1</span><span class="p">,</span><span class="w"></span><br /><span class="w"> </span><span class="nt">"beta"</span><span class="p">:</span><span class="w"> </span><span class="s2">"this is a string"</span><span class="w"></span><br /><span class="p">}]</span><span class="w"></span><br /></pre></div>
|
||||||
MARKDOWN_gte_33 = """
|
|
||||||
<div class="highlight"><pre><span></span><span class="p">[{</span><br />\
|
|
||||||
<span class="nt">"alpha"</span><span class="p">:</span>\
|
|
||||||
<span class="mi">1</span><span class="p">,</span><br />\
|
|
||||||
<span class="nt">"beta"</span><span class="p">:</span>\
|
|
||||||
<span class="s2">"this is a string"</span><br />\
|
|
||||||
<span class="p">}]</span><br /></pre></div>
|
|
||||||
<p><br /></p>"""
|
|
||||||
|
|
||||||
MARKDOWN_lt_33 = """
|
|
||||||
<div class="highlight"><pre><span></span><span class="p">[{</span><br />\
|
|
||||||
<span class="nt">"alpha"</span><span class="p">:</span>\
|
|
||||||
<span class="mi">1</span><span class="p">,</span><br />\
|
|
||||||
<span class="nt">"beta"</span><span class="p">:</span>\
|
|
||||||
<span class="s2">"this is a string"</span><br />\
|
|
||||||
<span class="p">}]</span><br /></pre></div>
|
|
||||||
|
|
||||||
<p><br /></p>"""
|
<p><br /></p>"""
|
||||||
|
|
||||||
|
|
||||||
|
@ -163,11 +144,7 @@ class TestViewNamesAndDescriptions(TestCase):
|
||||||
"""
|
"""
|
||||||
Ensure markdown to HTML works as expected.
|
Ensure markdown to HTML works as expected.
|
||||||
"""
|
"""
|
||||||
# Markdown 3.3 is only supported on Python 3.6 and higher
|
assert apply_markdown(DESCRIPTION) == MARKDOWN_DOCSTRING
|
||||||
if sys.version_info >= (3, 6):
|
|
||||||
assert apply_markdown(DESCRIPTION) == MARKDOWN_BASE % MARKDOWN_gte_33
|
|
||||||
else:
|
|
||||||
assert apply_markdown(DESCRIPTION) == MARKDOWN_BASE % MARKDOWN_lt_33
|
|
||||||
|
|
||||||
|
|
||||||
def test_dedent_tabs():
|
def test_dedent_tabs():
|
||||||
|
|
Loading…
Reference in New Issue
Block a user