From 0c29cf2df41600d3906d521c72991c7686018b71 Mon Sep 17 00:00:00 2001
From: Michael Merickel <michael@merickel.org>
Date: Mon, 15 Oct 2018 16:24:07 +0200
Subject: [PATCH] format source using black

---
 tests/test_config/test_routes.py |   55 ++++++++++++++++++++++++++++++++++++++-----------------
 1 files changed, 38 insertions(+), 17 deletions(-)

diff --git a/tests/test_config/test_routes.py b/tests/test_config/test_routes.py
index 870abe0..0999f80 100644
--- a/tests/test_config/test_routes.py
+++ b/tests/test_config/test_routes.py
@@ -4,14 +4,17 @@
 from . import DummyContext
 from pyramid.compat import text_
 
+
 class RoutesConfiguratorMixinTests(unittest.TestCase):
     def _makeOne(self, *arg, **kw):
         from pyramid.config import Configurator
+
         config = Configurator(*arg, **kw)
         return config
 
     def _assertRoute(self, config, name, path, num_predicates=0):
         from pyramid.interfaces import IRoutesMapper
+
         mapper = config.registry.getUtility(IRoutesMapper)
         routes = mapper.get_routes()
         route = routes[0]
@@ -33,6 +36,7 @@
 
     def test_get_routes_mapper_already_registered(self):
         from pyramid.interfaces import IRoutesMapper
+
         config = self._makeOne()
         mapper = object()
         config.registry.registerUtility(mapper, IRoutesMapper)
@@ -53,8 +57,9 @@
     def test_add_route_discriminator(self):
         config = self._makeOne()
         config.add_route('name', 'path')
-        self.assertEqual(config.action_state.actions[-1]['discriminator'],
-                         ('route', 'name'))
+        self.assertEqual(
+            config.action_state.actions[-1]['discriminator'], ('route', 'name')
+        )
 
     def test_add_route_with_factory(self):
         config = self._makeOne(autocommit=True)
@@ -68,13 +73,13 @@
         config.add_route('name', 'path/{foo}', static=True)
         mapper = config.get_routes_mapper()
         self.assertEqual(len(mapper.get_routes()), 0)
-        self.assertEqual(mapper.generate('name', {"foo":"a"}), '/path/a')
+        self.assertEqual(mapper.generate('name', {"foo": "a"}), '/path/a')
 
     def test_add_route_with_factory_dottedname(self):
         config = self._makeOne(autocommit=True)
         config.add_route(
-            'name', 'path',
-            factory='tests.test_config.dummyfactory')
+            'name', 'path', factory='tests.test_config.dummyfactory'
+        )
         route = self._assertRoute(config, 'name', 'path')
         self.assertEqual(route.factory, dummyfactory)
 
@@ -116,8 +121,9 @@
 
     def test_add_route_with_path_info_highorder(self):
         config = self._makeOne(autocommit=True)
-        config.add_route('name', 'path',
-                         path_info=text_(b'/La Pe\xc3\xb1a', 'utf-8'))
+        config.add_route(
+            'name', 'path', path_info=text_(b'/La Pe\xc3\xb1a', 'utf-8')
+        )
         route = self._assertRoute(config, 'name', 'path', 1)
         predicate = route.predicates[0]
         request = self._makeRequest(config)
@@ -129,8 +135,9 @@
 
     def test_add_route_with_path_info_regex(self):
         config = self._makeOne(autocommit=True)
-        config.add_route('name', 'path',
-                         path_info=text_(br'/La Pe\w*', 'utf-8'))
+        config.add_route(
+            'name', 'path', path_info=text_(br'/La Pe\w*', 'utf-8')
+        )
         route = self._assertRoute(config, 'name', 'path', 1)
         predicate = route.predicates[0]
         request = self._makeRequest(config)
@@ -146,7 +153,7 @@
         route = self._assertRoute(config, 'name', 'path', 1)
         predicate = route.predicates[0]
         request = self._makeRequest(config)
-        request.params = {'abc':'123'}
+        request.params = {'abc': '123'}
         self.assertEqual(predicate(None, request), True)
         request = self._makeRequest(config)
         request.params = {}
@@ -154,9 +161,15 @@
 
     def test_add_route_with_custom_predicates(self):
         import warnings
+
         config = self._makeOne(autocommit=True)
-        def pred1(context, request): pass
-        def pred2(context, request): pass
+
+        def pred1(context, request):
+            pass
+
+        def pred2(context, request):
+            pass
+
         with warnings.catch_warnings(record=True) as w:
             warnings.filterwarnings('always')
             config.add_route('name', 'path', custom_predicates=(pred1, pred2))
@@ -170,7 +183,7 @@
         route = self._assertRoute(config, 'name', 'path', 1)
         predicate = route.predicates[0]
         request = self._makeRequest(config)
-        request.headers = {'Host':'example.com'}
+        request.headers = {'Host': 'example.com'}
         self.assertEqual(predicate(None, request), True)
         request = self._makeRequest(config)
         request.headers = {}
@@ -222,6 +235,7 @@
 
     def test_add_route_no_path_no_pattern(self):
         from pyramid.exceptions import ConfigurationError
+
         config = self._makeOne()
         self.assertRaises(ConfigurationError, config.add_route, 'name')
 
@@ -234,46 +248,52 @@
     def test_add_route_no_view_with_view_attr(self):
         config = self._makeOne(autocommit=True)
         from pyramid.exceptions import ConfigurationError
+
         try:
             config.add_route('name', '/pattern', view_attr='abc')
         except ConfigurationError:
             pass
-        else: # pragma: no cover
+        else:  # pragma: no cover
             raise AssertionError
 
     def test_add_route_no_view_with_view_context(self):
         config = self._makeOne(autocommit=True)
         from pyramid.exceptions import ConfigurationError
+
         try:
             config.add_route('name', '/pattern', view_context=DummyContext)
         except ConfigurationError:
             pass
-        else: # pragma: no cover
+        else:  # pragma: no cover
             raise AssertionError
 
     def test_add_route_no_view_with_view_permission(self):
         config = self._makeOne(autocommit=True)
         from pyramid.exceptions import ConfigurationError
+
         try:
             config.add_route('name', '/pattern', view_permission='edit')
         except ConfigurationError:
             pass
-        else: # pragma: no cover
+        else:  # pragma: no cover
             raise AssertionError
 
     def test_add_route_no_view_with_view_renderer(self):
         config = self._makeOne(autocommit=True)
         from pyramid.exceptions import ConfigurationError
+
         try:
             config.add_route('name', '/pattern', view_renderer='json')
         except ConfigurationError:
             pass
-        else: # pragma: no cover
+        else:  # pragma: no cover
             raise AssertionError
+
 
 class DummyRequest:
     subpath = ()
     matchdict = None
+
     def __init__(self, environ=None):
         if environ is None:
             environ = {}
@@ -281,6 +301,7 @@
         self.params = {}
         self.cookies = {}
 
+
 class DummyAccept(object):
     def __init__(self, *matches, **kw):
         self.matches = list(matches)

--
Gitblit v1.9.3