Skip to content
Permalink
Browse files
flake8
  • Loading branch information
ralsina committed Oct 3, 2018
1 parent 1c176b5 commit f05aba72263d77c19bbf93b3b60356a42ff758c1
Showing with 22 additions and 20 deletions.
  1. +22 −20 tests/test_shortcodes.py
@@ -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!)'
@@ -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!",
@@ -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 '%}}'!",

0 comments on commit f05aba7

Please sign in to comment.