summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.flake82
-rw-r--r--src/pyramid/scripts/pcreate.py2
-rw-r--r--tests/test_scaffolds/test_template.py10
-rw-r--r--tests/test_urldispatch.py12
4 files changed, 15 insertions, 11 deletions
diff --git a/.flake8 b/.flake8
index f8da47c1a..958f8f9e0 100644
--- a/.flake8
+++ b/.flake8
@@ -6,6 +6,8 @@ ignore =
E731
# W503: line break before binary operator (flake8 is not PEP8 compliant)
W503
+ # W504: line break after binary operator (flake8 is not PEP8 compliant)
+ W504
exclude =
src/pyramid/compat.py
src/pyramid/scaffolds/alchemy
diff --git a/src/pyramid/scripts/pcreate.py b/src/pyramid/scripts/pcreate.py
index 902259089..ee3c60ee2 100644
--- a/src/pyramid/scripts/pcreate.py
+++ b/src/pyramid/scripts/pcreate.py
@@ -266,7 +266,7 @@ https://github.com/Pylons/pyramid-cookiecutter-starter
try:
# use absolute imports
__import__(pkg_name, globals(), locals(), [], 0)
- except ImportError as error:
+ except ImportError:
pkg_exists = False
if not pkg_exists:
return True
diff --git a/tests/test_scaffolds/test_template.py b/tests/test_scaffolds/test_template.py
index d9a2dfadb..fc6b9f371 100644
--- a/tests/test_scaffolds/test_template.py
+++ b/tests/test_scaffolds/test_template.py
@@ -46,23 +46,23 @@ class TestTemplate(unittest.TestCase):
def test_render_template_with_escaped_double_braces(self):
inst = self._makeOne()
result = inst.render_template(
- '{{a}} {{b}} \{\{a\}\} \{\{c\}\}', {'a': '1', 'b': '2'}
+ '{{a}} {{b}} \\{\\{a\\}\\} \\{\\{c\\}\\}', {'a': '1', 'b': '2'}
)
self.assertEqual(result, bytes_('1 2 {{a}} {{c}}'))
def test_render_template_with_breaking_escaped_braces(self):
inst = self._makeOne()
result = inst.render_template(
- '{{a}} {{b}} \{\{a\} \{b\}\}', {'a': '1', 'b': '2'}
+ '{{a}} {{b}} \\{\\{a\\} \\{b\\}\\}', {'a': '1', 'b': '2'}
)
- self.assertEqual(result, bytes_('1 2 \{\{a\} \{b\}\}'))
+ self.assertEqual(result, bytes_('1 2 \\{\\{a\\} \\{b\\}\\}'))
def test_render_template_with_escaped_single_braces(self):
inst = self._makeOne()
result = inst.render_template(
- '{{a}} {{b}} \{a\} \{b', {'a': '1', 'b': '2'}
+ '{{a}} {{b}} \\{a\\} \\{b', {'a': '1', 'b': '2'}
)
- self.assertEqual(result, bytes_('1 2 \{a\} \{b'))
+ self.assertEqual(result, bytes_('1 2 \\{a\\} \\{b'))
def test_module_dir(self):
import sys
diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py
index 57f81b527..772250e89 100644
--- a/tests/test_urldispatch.py
+++ b/tests/test_urldispatch.py
@@ -346,7 +346,9 @@ class TestCompileRoute(unittest.TestCase):
self.assertEqual(generator({'baz': 1, 'buz': 2}), '/foo/1/biz/2/bar')
def test_custom_regex(self):
- matcher, generator = self._callFUT('foo/{baz}/biz/{buz:[^/\.]+}.{bar}')
+ matcher, generator = self._callFUT(
+ 'foo/{baz}/biz/{buz:[^/\\.]+}.{bar}'
+ )
self.assertEqual(
matcher('/foo/baz/biz/buz.bar'),
{'baz': 'baz', 'buz': 'buz', 'bar': 'bar'},
@@ -358,7 +360,7 @@ class TestCompileRoute(unittest.TestCase):
def test_custom_regex_with_colons(self):
matcher, generator = self._callFUT(
- 'foo/{baz}/biz/{buz:(?:[^/\.]+)}.{bar}'
+ 'foo/{baz}/biz/{buz:(?:[^/\\.]+)}.{bar}'
)
self.assertEqual(
matcher('/foo/baz/biz/buz.bar'),
@@ -379,13 +381,13 @@ class TestCompileRoute(unittest.TestCase):
self.assertEqual(generator({'baz': 1, 'buz': 2}), '/foo/1/biz/2/bar')
def test_custom_regex_with_embedded_squigglies(self):
- matcher, generator = self._callFUT('/{buz:\d{4}}')
+ matcher, generator = self._callFUT('/{buz:\\d{4}}')
self.assertEqual(matcher('/2001'), {'buz': '2001'})
self.assertEqual(matcher('/200'), None)
self.assertEqual(generator({'buz': 2001}), '/2001')
def test_custom_regex_with_embedded_squigglies2(self):
- matcher, generator = self._callFUT('/{buz:\d{3,4}}')
+ matcher, generator = self._callFUT('/{buz:\\d{3,4}}')
self.assertEqual(matcher('/2001'), {'buz': '2001'})
self.assertEqual(matcher('/200'), {'buz': '200'})
self.assertEqual(matcher('/20'), None)
@@ -393,7 +395,7 @@ class TestCompileRoute(unittest.TestCase):
def test_custom_regex_with_embedded_squigglies3(self):
matcher, generator = self._callFUT(
- '/{buz:(\d{2}|\d{4})-[a-zA-Z]{3,4}-\d{2}}'
+ '/{buz:(\\d{2}|\\d{4})-[a-zA-Z]{3,4}-\\d{2}}'
)
self.assertEqual(matcher('/2001-Nov-15'), {'buz': '2001-Nov-15'})
self.assertEqual(matcher('/99-June-10'), {'buz': '99-June-10'})