From 0c29cf2df41600d3906d521c72991c7686018b71 Mon Sep 17 00:00:00 2001 From: Michael Merickel Date: Mon, 15 Oct 2018 01:55:54 -0500 Subject: format source using black --- tests/test_wsgi.py | 27 ++++++++++++++++++--------- 1 file changed, 18 insertions(+), 9 deletions(-) (limited to 'tests/test_wsgi.py') diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index 4ddbc9201..a5a955621 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -1,8 +1,10 @@ import unittest + class WSGIAppTests(unittest.TestCase): def _callFUT(self, app): from pyramid.wsgi import wsgiapp + return wsgiapp(app) def test_wsgiapp_none(self): @@ -23,9 +25,11 @@ class WSGIAppTests(unittest.TestCase): response = decorator(context, request) self.assertEqual(response, app) + class WSGIApp2Tests(unittest.TestCase): def _callFUT(self, app): from pyramid.wsgi import wsgiapp2 + return wsgiapp2(app) def test_wsgiapp2_none(self): @@ -35,8 +39,10 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = ('subpath',) - request.environ = {'SCRIPT_NAME':'/foo', - 'PATH_INFO':'/b/view_name/subpath'} + request.environ = { + 'SCRIPT_NAME': '/foo', + 'PATH_INFO': '/b/view_name/subpath', + } decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -47,7 +53,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = ('subpath',) - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/b/subpath'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/b/subpath'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -58,7 +64,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/b/view_name'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/b/view_name'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -69,7 +75,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/view_name'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/view_name'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -80,7 +86,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -91,7 +97,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '', 'PATH_INFO': '/'} decorator = self._callFUT(dummyapp) response = decorator(context, request) self.assertEqual(response, dummyapp) @@ -102,7 +108,7 @@ class WSGIApp2Tests(unittest.TestCase): context = DummyContext() request = DummyRequest() request.subpath = () - request.environ = {'SCRIPT_NAME':'/foo', 'PATH_INFO':'/'} + request.environ = {'SCRIPT_NAME': '/foo', 'PATH_INFO': '/'} app = DummyApp() decorator = self._callFUT(app) response = decorator(context, request) @@ -110,16 +116,20 @@ class WSGIApp2Tests(unittest.TestCase): self.assertEqual(request.environ['PATH_INFO'], '/') self.assertEqual(request.environ['SCRIPT_NAME'], '/foo') + def dummyapp(environ, start_response): """ """ + class DummyApp(object): def __call__(self, environ, start_response): """ """ + class DummyContext: pass + class DummyRequest: def get_response(self, application): return application @@ -127,4 +137,3 @@ class DummyRequest: def copy(self): self.copied = True return self - -- cgit v1.2.3