Skip to content

Commit

Permalink
test_github_backtick_syntax_for_code: Use files
Browse files Browse the repository at this point in the history
Solves PEP 8 line too long errors
  • Loading branch information
msabramo committed Jul 29, 2016
1 parent 278d3f5 commit bb91f67
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
6 changes: 6 additions & 0 deletions tests/fixtures/markdown/code.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<p>Here is some Python:</p>
<div><pre><span class="kn">import</span> <span class="nn">os</span>

<span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="n">fn</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">open</span><span class="p">(</span><span class="n">fn</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
</pre></div>
8 changes: 8 additions & 0 deletions tests/fixtures/markdown/code.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Here is some Python:

```python
import os

def read(fn):
return open(fn).read()
```
26 changes: 4 additions & 22 deletions tests/test_markdown.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,28 +59,6 @@ def test_a_tag_gets_nofollow():
assert out in expected_htmls


def test_github_backtick_syntax_for_code():
markdown_markup = """\
Here is some Python:
```python
import os
def read(fn):
return open(fn).read()
```"""
out, rendered = render(markdown_markup)
expected_html = """\
<p>Here is some Python:</p>
<div><pre><span class="kn">import</span> <span class="nn">os</span>
<span class="k">def</span> <span class="nf">read</span><span class="p">(</span><span class="n">fn</span><span class="p">):</span>
<span class="k">return</span> <span class="nb">open</span><span class="p">(</span><span class="n">fn</span><span class="p">)</span><span class="o">.</span><span class="n">read</span><span class="p">()</span>
</pre></div>"""
assert rendered
assert out == expected_html


def test_smart_strong():
markdown_markup = 'Text with double__underscore__words.'
out, rendered = render(markdown_markup)
Expand All @@ -89,6 +67,10 @@ def test_smart_strong():
assert out == expected_html


def test_github_backtick_syntax_for_code():
_do_test_with_files('code')


def test_headings_and_paragraphs():
_do_test_with_files('headings_and_paragraphs')

Expand Down

0 comments on commit bb91f67

Please sign in to comment.