Skip to content

Commit

Permalink
flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
ralsina committed Oct 3, 2018
1 parent 1c176b5 commit f05aba7
Showing 1 changed file with 22 additions and 20 deletions.
42 changes: 22 additions & 20 deletions tests/test_shortcodes.py
Expand Up @@ -27,8 +27,10 @@ def _fakesite():
s.register_shortcode('arg', arg)
return s


fakesite = pytest.fixture(scope="module")(_fakesite)


def test_noargs(fakesite):
assert shortcodes.apply_shortcodes(
'test({{% noargs %}})', fakesite.shortcode_registry)[0] == 'test(noargs success!)'
Expand Down Expand Up @@ -95,25 +97,25 @@ def test_errors(self):
shortcodes.apply_shortcodes, '{{% start "asdf %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
self.assertRaisesRegex(shortcodes.ParsingError,
"^String starting at .* must be non-empty!",
shortcodes.apply_shortcodes,
'{{% start =b %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
"^String starting at .* must be non-empty!",
shortcodes.apply_shortcodes,
'{{% start =b %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
self.assertRaisesRegex(shortcodes.ParsingError,
"^Unexpected end of data while escaping",
shortcodes.apply_shortcodes, '{{% start "a\\',
self.fakesite.shortcode_registry,
raise_exceptions=True)
"^Unexpected end of data while escaping",
shortcodes.apply_shortcodes, '{{% start "a\\',
self.fakesite.shortcode_registry,
raise_exceptions=True)
self.assertRaisesRegex(shortcodes.ParsingError,
"^Unexpected end of data while escaping",
shortcodes.apply_shortcodes, '{{% start a\\',
self.fakesite.shortcode_registry,
raise_exceptions=True)
"^Unexpected end of data while escaping",
shortcodes.apply_shortcodes, '{{% start a\\',
self.fakesite.shortcode_registry,
raise_exceptions=True)
self.assertRaisesRegex(shortcodes.ParsingError,
"^Unexpected quotation mark in unquoted string",
shortcodes.apply_shortcodes,
'{{% start a"b" %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
"^Unexpected quotation mark in unquoted string",
shortcodes.apply_shortcodes,
'{{% start a"b" %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
self.assertRaisesRegex(
shortcodes.ParsingError,
"^Syntax error in shortcode 'start' at .*: expecting whitespace!",
Expand All @@ -140,10 +142,10 @@ def test_errors(self):
shortcodes.apply_shortcodes, '{{% / %}}', self.fakesite.
shortcode_registry, raise_exceptions=True)
self.assertRaisesRegex(shortcodes.ParsingError,
"^Syntax error: '{{% /' must be followed by ' %}}'",
shortcodes.apply_shortcodes, '{{% / a %}}',
self.fakesite.shortcode_registry,
raise_exceptions=True)
"^Syntax error: '{{% /' must be followed by ' %}}'",
shortcodes.apply_shortcodes, '{{% / a %}}',
self.fakesite.shortcode_registry,
raise_exceptions=True)
self.assertRaisesRegex(
shortcodes.ParsingError,
"^Shortcode '<==' starting at .* is not terminated correctly with '%}}'!",
Expand Down

0 comments on commit f05aba7

Please sign in to comment.