diff options
Diffstat (limited to 'tests')
48 files changed, 241 insertions, 241 deletions
diff --git a/tests/pkgs/eventonly/__init__.py b/tests/pkgs/eventonly/__init__.py index 35d83838f..d0d4dafb9 100644 --- a/tests/pkgs/eventonly/__init__.py +++ b/tests/pkgs/eventonly/__init__.py @@ -2,7 +2,7 @@ from pyramid.events import subscriber from pyramid.view import view_config -class Yup(object): +class Yup: def __init__(self, val, config): self.val = val @@ -15,12 +15,12 @@ class Yup(object): return getattr(event.response, 'yup', False) -class Foo(object): +class Foo: def __init__(self, response): self.response = response -class Bar(object): +class Bar: pass diff --git a/tests/pkgs/exceptionviewapp/models.py b/tests/pkgs/exceptionviewapp/models.py index 25f8e9156..e724b5c96 100644 --- a/tests/pkgs/exceptionviewapp/models.py +++ b/tests/pkgs/exceptionviewapp/models.py @@ -1,4 +1,4 @@ -class NotAnException(object): +class NotAnException: pass @@ -6,11 +6,11 @@ class AnException(Exception): pass -class RouteContext(object): +class RouteContext: pass -class RouteContext2(object): +class RouteContext2: pass diff --git a/tests/pkgs/restbugapp/views.py b/tests/pkgs/restbugapp/views.py index 161321aed..429ad0ea2 100644 --- a/tests/pkgs/restbugapp/views.py +++ b/tests/pkgs/restbugapp/views.py @@ -1,7 +1,7 @@ from pyramid.response import Response -class BaseRESTView(object): +class BaseRESTView: def __init__(self, context, request): self.context = context self.request = request diff --git a/tests/pkgs/staticpermapp/__init__.py b/tests/pkgs/staticpermapp/__init__.py index a12eac2d3..40ad7f527 100644 --- a/tests/pkgs/staticpermapp/__init__.py +++ b/tests/pkgs/staticpermapp/__init__.py @@ -1,11 +1,11 @@ -class RootFactory(object): +class RootFactory: __acl__ = [('Allow', 'fred', 'view')] def __init__(self, request): pass -class LocalRootFactory(object): +class LocalRootFactory: __acl__ = [('Allow', 'bob', 'view')] def __init__(self, request): diff --git a/tests/test_authentication.py b/tests/test_authentication.py index 5b67a30da..6d3b154e7 100644 --- a/tests/test_authentication.py +++ b/tests/test_authentication.py @@ -1962,7 +1962,7 @@ class DummyContext: pass -class DummyCookies(object): +class DummyCookies: def __init__(self, cookie): self.cookie = cookie @@ -2007,7 +2007,7 @@ class DummyCookieHelper: return [] -class DummyAuthTktModule(object): +class DummyAuthTktModule: def __init__( self, timestamp=0, @@ -2034,7 +2034,7 @@ class DummyAuthTktModule(object): self.parse_ticket = parse_ticket - class AuthTicket(object): + class AuthTicket: def __init__(self, secret, userid, remote_addr, **kw): self.secret = secret self.userid = userid diff --git a/tests/test_config/__init__.py b/tests/test_config/__init__.py index 99677ebc5..1fb1cd53e 100644 --- a/tests/test_config/__init__.py +++ b/tests/test_config/__init__.py @@ -33,7 +33,7 @@ class DummyContext: @implementer(IFactory) -class DummyFactory(object): +class DummyFactory: def __call__(self): """ """ @@ -61,7 +61,7 @@ def dummy_extend2(config, discrim): dummy_partial = partial(dummy_extend, discrim='partial') -class DummyCallable(object): +class DummyCallable: def __call__(self, config, discrim): config.action(discrim, None, config.package) diff --git a/tests/test_config/pkgs/scannable/__init__.py b/tests/test_config/pkgs/scannable/__init__.py index e0042a5cc..f0e730e15 100644 --- a/tests/test_config/pkgs/scannable/__init__.py +++ b/tests/test_config/pkgs/scannable/__init__.py @@ -18,7 +18,7 @@ def stacked(context, request): return 'stacked' -class stacked_class(object): +class stacked_class: def __init__(self, context, request): self.context = context self.request = request @@ -49,7 +49,7 @@ oldstyle_grokked_class = view_config( )(oldstyle_grokked_class) -class grokked_class(object): +class grokked_class: def __init__(self, context, request): self.context = context self.request = request @@ -63,7 +63,7 @@ grokked_class = view_config(name='grokked_class', renderer=null_renderer)( ) -class Foo(object): +class Foo: def __call__(self, context, request): return 'grokked_instance' @@ -74,7 +74,7 @@ grokked_instance = view_config( )(grokked_instance) -class Base(object): +class Base: @view_config(name='basemethod', renderer=null_renderer) def basemethod(self): """ """ @@ -109,7 +109,7 @@ def stuff(): """ """ -class Whatever(object): +class Whatever: pass diff --git a/tests/test_config/pkgs/scannable/another.py b/tests/test_config/pkgs/scannable/another.py index 31e7f5128..8a1c726a0 100644 --- a/tests/test_config/pkgs/scannable/another.py +++ b/tests/test_config/pkgs/scannable/another.py @@ -18,7 +18,7 @@ def stacked(context, request): return 'another_stacked' -class stacked_class(object): +class stacked_class: def __init__(self, context, request): self.context = context self.request = request @@ -49,7 +49,7 @@ oldstyle_grokked_class = view_config( )(oldstyle_grokked_class) -class grokked_class(object): +class grokked_class: def __init__(self, context, request): self.context = context self.request = request @@ -63,7 +63,7 @@ grokked_class = view_config( )(grokked_class) -class Foo(object): +class Foo: def __call__(self, context, request): return 'another_grokked_instance' diff --git a/tests/test_config/test_actions.py b/tests/test_config/test_actions.py index aa86f3792..b1f4b4b99 100644 --- a/tests/test_config/test_actions.py +++ b/tests/test_config/test_actions.py @@ -1072,7 +1072,7 @@ def _conflictFunctions(e): yield confinst.function -class DummyActionState(object): +class DummyActionState: autocommit = False info = '' @@ -1083,7 +1083,7 @@ class DummyActionState(object): self.actions.append((arg, kw)) -class DummyIntrospectable(object): +class DummyIntrospectable: def __init__(self): self.registered = [] diff --git a/tests/test_config/test_adapters.py b/tests/test_config/test_adapters.py index 60a4f3090..8c7f00751 100644 --- a/tests/test_config/test_adapters.py +++ b/tests/test_config/test_adapters.py @@ -244,7 +244,7 @@ class AdaptersConfiguratorMixinTests(unittest.TestCase): config = self._makeOne(autocommit=True) - class Adapter(object): + class Adapter: def __init__(self, other): self.other = other @@ -257,7 +257,7 @@ class AdaptersConfiguratorMixinTests(unittest.TestCase): config = self._makeOne(autocommit=True) - class Adapter(object): + class Adapter: pass config.add_response_adapter(None, Adapter) @@ -396,23 +396,23 @@ class Test_eventonly(unittest.TestCase): self.assertTrue(self._callFUT(acallable)) -class DummyTraverser(object): +class DummyTraverser: def __init__(self, root): self.root = root -class DummyIface(object): +class DummyIface: pass -class DummyResourceURL(object): +class DummyResourceURL: def __init__(self, resource, request): self.resource = resource self.request = request def predicate_maker(name): - class Predicate(object): + class Predicate: def __init__(self, val, config): self.val = val diff --git a/tests/test_config/test_assets.py b/tests/test_config/test_assets.py index cfd786c5d..3cfea7fe4 100644 --- a/tests/test_config/test_assets.py +++ b/tests/test_config/test_assets.py @@ -820,7 +820,7 @@ class TestPackageOverrides(unittest.TestCase): self.assertEqual(loader._got_source, 'whatever') -class AssetSourceIntegrationTests(object): +class AssetSourceIntegrationTests: def test_get_filename(self): source = self._makeOne('') self.assertEqual( diff --git a/tests/test_config/test_init.py b/tests/test_config/test_init.py index ebcd78bb6..5ca3063c5 100644 --- a/tests/test_config/test_init.py +++ b/tests/test_config/test_init.py @@ -435,10 +435,10 @@ class ConfiguratorTests(unittest.TestCase): pass @implementer(IFoo) - class Foo(object): + class Foo: pass - class Bar(object): + class Bar: pass adaptation = () @@ -925,7 +925,7 @@ test_config.dummy_include2""" config = self._makeOne() - class DummyInspect(object): + class DummyInspect: def getmodule(self, c): return inspect.getmodule(c) @@ -1419,7 +1419,7 @@ class DummyRequest: self.cookies = {} -class DummyThreadLocalManager(object): +class DummyThreadLocalManager: def __init__(self): self.pushed = {'registry': None, 'request': None} self.popped = False @@ -1434,7 +1434,7 @@ class DummyThreadLocalManager(object): self.popped = True -class DummyRegistry(object): +class DummyRegistry: def __init__(self, adaptation=None, util=None): self.utilities = [] self.adapters = [] @@ -1458,5 +1458,5 @@ class DummyRegistry(object): return self.util -class DummyPredicate(object): +class DummyPredicate: pass diff --git a/tests/test_config/test_predicates.py b/tests/test_config/test_predicates.py index f8abbbce4..d1562947e 100644 --- a/tests/test_config/test_predicates.py +++ b/tests/test_config/test_predicates.py @@ -200,7 +200,7 @@ class TestPredicateList(unittest.TestCase): def test_different_custom_predicates_with_same_hash(self): from pyramid.config.predicates import predvalseq - class PredicateWithHash(object): + class PredicateWithHash: def __hash__(self): return 1 @@ -443,7 +443,7 @@ class Test_sort_accept_offers(unittest.TestCase): ) -class DummyCustomPredicate(object): +class DummyCustomPredicate: def __init__(self): self.__text__ = 'custom predicate' @@ -458,7 +458,7 @@ class DummyCustomPredicate(object): pass # pragma: no cover -class Dummy(object): +class Dummy: def __init__(self, **kw): self.__dict__.update(**kw) @@ -475,7 +475,7 @@ class DummyRequest: self.cookies = {} -class DummyConfigurator(object): +class DummyConfigurator: package = 'dummy package' registry = 'dummy registry' diff --git a/tests/test_config/test_routes.py b/tests/test_config/test_routes.py index bbafa8784..8227784ec 100644 --- a/tests/test_config/test_routes.py +++ b/tests/test_config/test_routes.py @@ -332,7 +332,7 @@ class DummyRequest: self.cookies = {} -class DummyAccept(object): +class DummyAccept: def __init__(self, *matches, **kw): self.matches = list(matches) self.contains = kw.pop('contains', False) diff --git a/tests/test_config/test_tweens.py b/tests/test_config/test_tweens.py index ff75461c3..b8cf15e12 100644 --- a/tests/test_config/test_tweens.py +++ b/tests/test_config/test_tweens.py @@ -117,7 +117,7 @@ class TestTweensConfiguratorMixin(unittest.TestCase): def test_add_tween_instance(self): from pyramid.exceptions import ConfigurationError - class ATween(object): + class ATween: pass atween = ATween() diff --git a/tests/test_config/test_views.py b/tests/test_config/test_views.py index 3aecc721a..6b34f1bd4 100644 --- a/tests/test_config/test_views.py +++ b/tests/test_config/test_views.py @@ -1322,13 +1322,13 @@ class TestViewsConfigurationMixin(unittest.TestCase): from pyramid.renderers import null_renderer as nr from pyramid.router import Router - class OtherBase(object): + class OtherBase: pass - class Int1(object): + class Int1: pass - class Int2(object): + class Int2: pass class Resource(OtherBase, Int1, Int2): @@ -1370,13 +1370,13 @@ class TestViewsConfigurationMixin(unittest.TestCase): from pyramid.renderers import null_renderer as nr from pyramid.router import Router - class OtherBase(object): + class OtherBase: pass - class Int1(object): + class Int1: pass - class Int2(object): + class Int2: pass class Resource(OtherBase, Int1, Int2): @@ -1433,11 +1433,11 @@ class TestViewsConfigurationMixin(unittest.TestCase): pass @implementer(IFoo) - class Foo(object): + class Foo: pass @implementer(IBar) - class Bar(object): + class Bar: pass foo = Foo() @@ -1468,7 +1468,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): from tests import test_config from pyramid.interfaces import ISettings - class view(object): + class view: def __init__(self, context, request): self.request = request self.context = context @@ -1494,7 +1494,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): self.assertEqual(result.settings, settings) def test_add_view_with_default_renderer(self): - class view(object): + class view: def __init__(self, context, request): self.request = request self.context = context @@ -1504,7 +1504,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): config = self._makeOne(autocommit=True) - class moo(object): + class moo: def __init__(self, *arg, **kw): pass @@ -2042,7 +2042,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): view1 = lambda *arg: 'OK' outerself = self - class DummyPolicy(object): + class DummyPolicy: def permits(self, r, context, permission): outerself.assertEqual(r, request) outerself.assertEqual(context, None) @@ -2062,7 +2062,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): view1 = lambda *arg: 'OK' outerself = self - class DummyPolicy(object): + class DummyPolicy: def permits(self, r, context, permission): outerself.assertEqual(r, request) outerself.assertEqual(context, None) @@ -2083,7 +2083,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): view1 = lambda *arg: 'OK' - class DummyPolicy(object): + class DummyPolicy: pass # wont be called policy = DummyPolicy() @@ -2100,7 +2100,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): def test_add_view_with_mapper(self): from pyramid.renderers import null_renderer - class Mapper(object): + class Mapper: def __init__(self, **kw): self.__class__.kw = kw @@ -2122,7 +2122,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): from pyramid.exceptions import PredicateMismatch from zope.interface import directlyProvides - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): @@ -2183,10 +2183,10 @@ class TestViewsConfigurationMixin(unittest.TestCase): def test_add_view_with_view_config_and_view_defaults_doesnt_conflict(self): from pyramid.renderers import null_renderer - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} - class view2(object): + class view2: __view_defaults__ = {'containment': 'tests.test_config.IFactory'} config = self._makeOne(autocommit=False) @@ -2197,10 +2197,10 @@ class TestViewsConfigurationMixin(unittest.TestCase): def test_add_view_with_view_config_and_view_defaults_conflicts(self): from pyramid.renderers import null_renderer - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} - class view2(object): + class view2: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} config = self._makeOne(autocommit=False) @@ -2214,7 +2214,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): config = self._makeOne(autocommit=True) - class DummyViewClass(object): + class DummyViewClass: def run(self): # pragma: no cover pass @@ -2261,7 +2261,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): view = lambda *arg: 'OK' config = self._makeOne(autocommit=True) - class NotAnException(object): + class NotAnException: pass self.assertRaises( @@ -2353,7 +2353,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): from zope.interface import directlyProvides from zope.interface import implementedBy - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): @@ -2401,7 +2401,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): def test_derive_view_with_default_renderer_no_explicit_renderer(self): config = self._makeOne() - class moo(object): + class moo: def __init__(self, view): pass @@ -2419,10 +2419,10 @@ class TestViewsConfigurationMixin(unittest.TestCase): self.assertEqual(result(None, None).body, b'moo') def test_derive_view_with_default_renderer_with_explicit_renderer(self): - class moo(object): + class moo: pass - class foo(object): + class foo: def __init__(self, view): pass @@ -2578,7 +2578,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): from zope.interface import directlyProvides from zope.interface import implementedBy - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): @@ -2742,7 +2742,7 @@ class TestViewsConfigurationMixin(unittest.TestCase): from zope.interface import directlyProvides from zope.interface import implementedBy - class view(object): + class view: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): @@ -3020,7 +3020,7 @@ class Test_requestonly(unittest.TestCase): self.assertTrue(self._callFUT(aview)) def test_otherattr(self): - class AView(object): + class AView: def __init__(self, request, a=1, b=2): # pragma: no cover pass @@ -3465,7 +3465,7 @@ class TestDefaultViewMapper(unittest.TestCase): self.assertRaises(TypeError, result, None, request) def test_view_as_newstyle_class_context_and_request(self): - class view(object): + class view: def __init__(self, context, request): pass @@ -3479,7 +3479,7 @@ class TestDefaultViewMapper(unittest.TestCase): self.assertEqual(result(None, request), 'OK') def test_view_as_newstyle_class_context_and_request_with_attr(self): - class view(object): + class view: def __init__(self, context, request): pass @@ -3493,7 +3493,7 @@ class TestDefaultViewMapper(unittest.TestCase): self.assertEqual(result(None, request), 'OK') def test_view_as_newstyle_class_requestonly(self): - class view(object): + class view: def __init__(self, request): pass @@ -3507,7 +3507,7 @@ class TestDefaultViewMapper(unittest.TestCase): self.assertEqual(result(None, request), 'OK') def test_view_as_newstyle_class_requestonly_with_attr(self): - class view(object): + class view: def __init__(self, request): pass @@ -4185,7 +4185,7 @@ class DummyRegistry: @implementer(IResponse) -class DummyResponse(object): +class DummyResponse: content_type = None default_content_type = None body = None @@ -4210,7 +4210,7 @@ class DummyContext: pass -class DummyAccept(object): +class DummyAccept: def __init__(self, *matches, **kw): self.matches = list(matches) self.contains = kw.pop('contains', False) @@ -4260,7 +4260,7 @@ class DummyMultiView: """ """ -class DummyCacheBuster(object): +class DummyCacheBuster: def __init__(self, token): self.token = token @@ -4293,7 +4293,7 @@ class DummyStaticURLInfo: self.added.append((config, name, spec, kw)) -class DummyViewDefaultsClass(object): +class DummyViewDefaultsClass: __view_defaults__ = {'containment': 'tests.test_config.IDummy'} def __init__(self, request): @@ -4303,7 +4303,7 @@ class DummyViewDefaultsClass(object): return 'OK' -class DummyPredicate(object): +class DummyPredicate: def __init__(self, val, config): self.val = val @@ -4313,7 +4313,7 @@ class DummyPredicate(object): phash = text -class DummyIntrospector(object): +class DummyIntrospector: def __init__(self, getval=None): self.related = [] self.introspectables = [] diff --git a/tests/test_csrf.py b/tests/test_csrf.py index ae998ec95..8e1302396 100644 --- a/tests/test_csrf.py +++ b/tests/test_csrf.py @@ -5,7 +5,7 @@ from pyramid.config import Configurator class TestLegacySessionCSRFStoragePolicy(unittest.TestCase): - class MockSession(object): + class MockSession: def __init__(self, current_token='02821185e4c94269bdc38e6eeae0a2f8'): self.current_token = current_token @@ -455,7 +455,7 @@ class Test_check_csrf_origin(unittest.TestCase): self.assertFalse(self._callFUT(request, raises=False)) -class DummyRequest(object): +class DummyRequest: registry = None session = None response_callback = None @@ -469,12 +469,12 @@ class DummyRequest(object): self.response_callback = callback -class MockResponse(object): +class MockResponse: def __init__(self): self.headerlist = [] -class DummyCSRF(object): +class DummyCSRF: def new_csrf_token(self, request): return 'e5e9e30a08b34ff9842ff7d2b958c14b' diff --git a/tests/test_decorator.py b/tests/test_decorator.py index 2dcc9b4d3..b9a1f1e9d 100644 --- a/tests/test_decorator.py +++ b/tests/test_decorator.py @@ -26,5 +26,5 @@ class TestReify(unittest.TestCase): self.assertEqual(result, decorator) -class Dummy(object): +class Dummy: pass diff --git a/tests/test_events.py b/tests/test_events.py index b344738a3..285a84274 100644 --- a/tests/test_events.py +++ b/tests/test_events.py @@ -377,7 +377,7 @@ class TestBeforeRender(unittest.TestCase): self.assertTrue(event.rendering_val is val) -class DummyConfigurator(object): +class DummyConfigurator: def __init__(self): self.subscribed = [] @@ -388,11 +388,11 @@ class DummyConfigurator(object): self.subscribed.append((wrapped, ifaces, predicates)) -class DummyRegistry(object): +class DummyRegistry: pass -class DummyVenusian(object): +class DummyVenusian: def __init__(self): self.attached = [] diff --git a/tests/test_httpexceptions.py b/tests/test_httpexceptions.py index 5decfc39c..a246dbaa6 100644 --- a/tests/test_httpexceptions.py +++ b/tests/test_httpexceptions.py @@ -74,7 +74,7 @@ class Test__no_escape(unittest.TestCase): ) def test_unicode(self): - class DummyUnicodeObject(object): + class DummyUnicodeObject: def __unicode__(self): return text_('42') @@ -392,7 +392,7 @@ class TestHTTPException(unittest.TestCase): exc = cls(body_template='${REQUEST_METHOD}') environ = _makeEnviron() - class Choke(object): + class Choke: def __str__(self): # pragma no cover raise ValueError @@ -514,11 +514,11 @@ class TestHTTPMethodNotAllowed(unittest.TestCase): ) -class DummyRequest(object): +class DummyRequest: exception = None -class DummyStartResponse(object): +class DummyStartResponse: def __call__(self, status, headerlist): self.status = status self.headerlist = headerlist diff --git a/tests/test_i18n.py b/tests/test_i18n.py index 4ac6bd4e2..b5500af37 100644 --- a/tests/test_i18n.py +++ b/tests/test_i18n.py @@ -532,7 +532,7 @@ class TestLocalizerRequestMixin(unittest.TestCase): self.assertEqual(result.translate('Approve', 'deformsite'), 'Approve') -class DummyRequest(object): +class DummyRequest: def __init__(self): self.params = {} self.cookies = {} @@ -542,7 +542,7 @@ def dummy_negotiator(request): return 'bogus' -class DummyTranslations(object): +class DummyTranslations: def ugettext(self, text): return text diff --git a/tests/test_integration.py b/tests/test_integration.py index 8a4575d7b..9a690a8d3 100644 --- a/tests/test_integration.py +++ b/tests/test_integration.py @@ -62,7 +62,7 @@ class WGSIAppPlusViewConfigTests(unittest.TestCase): self.assertEqual(view.__original_view__, wsgiapptest) -class IntegrationBase(object): +class IntegrationBase: root_factory = None package = None @@ -966,7 +966,7 @@ class AcceptContentTypeTest(unittest.TestCase): self.assertEqual(res.content_type, 'text/x-fallback') -class DummyContext(object): +class DummyContext: pass diff --git a/tests/test_location.py b/tests/test_location.py index 86fb8bfa8..4a36f00fd 100644 --- a/tests/test_location.py +++ b/tests/test_location.py @@ -48,5 +48,5 @@ class TestLineage(unittest.TestCase): @implementer(ILocation) -class Location(object): +class Location: __name__ = __parent__ = None diff --git a/tests/test_paster.py b/tests/test_paster.py index ef2571471..09e3bb868 100644 --- a/tests/test_paster.py +++ b/tests/test_paster.py @@ -131,7 +131,7 @@ class Test_bootstrap(unittest.TestCase): self.app = app = DummyApp() self.root = root = Dummy() - class DummyGetApp(object): + class DummyGetApp: def __call__(self, *a, **kw): self.a = a self.kw = kw @@ -139,7 +139,7 @@ class Test_bootstrap(unittest.TestCase): self.get_app = pyramid.paster.get_app = DummyGetApp() - class DummyPrepare(object): + class DummyPrepare: def __call__(self, *a, **kw): self.a = a self.kw = kw @@ -166,7 +166,7 @@ class Dummy: pass -class DummyRegistry(object): +class DummyRegistry: settings = {} diff --git a/tests/test_path.py b/tests/test_path.py index e9fe94fe2..384460fb1 100644 --- a/tests/test_path.py +++ b/tests/test_path.py @@ -68,10 +68,10 @@ class TestCallerModule(unittest.TestCase): self.assertNotEqual(result, test_path) def test_it_no___name__(self): - class DummyFrame(object): + class DummyFrame: f_globals = {} - class DummySys(object): + class DummySys: def _getframe(self, level): return DummyFrame() @@ -627,7 +627,7 @@ class TestDottedNameResolver(unittest.TestCase): self.assertEqual(typ.package, None) -class DummyPkgResource(object): +class DummyPkgResource: pass diff --git a/tests/test_predicates.py b/tests/test_predicates.py index 533667d75..1cc3f4aa5 100644 --- a/tests/test_predicates.py +++ b/tests/test_predicates.py @@ -537,7 +537,7 @@ class TestNotted(unittest.TestCase): self.assertEqual(inst(None, None), True) -class predicate(object): +class predicate: def __repr__(self): return 'predicate' @@ -545,11 +545,11 @@ class predicate(object): return 1 -class Dummy(object): +class Dummy: pass -class DummyPredicate(object): +class DummyPredicate: def __init__(self, result): self.result = result diff --git a/tests/test_registry.py b/tests/test_registry.py index 81443ce47..ce0370468 100644 --- a/tests/test_registry.py +++ b/tests/test_registry.py @@ -407,7 +407,7 @@ class TestIntrospectable(unittest.TestCase): ) -class DummyIntrospector(object): +class DummyIntrospector: def __init__(self): self.intrs = [] self.relations = [] @@ -429,7 +429,7 @@ class DummyModule: __file__ = '' -class DummyIntrospectable(object): +class DummyIntrospectable: category_name = 'category' discriminator = 'discriminator' title = 'title' @@ -447,5 +447,5 @@ class IDummyEvent(Interface): @implementer(IDummyEvent) -class DummyEvent(object): +class DummyEvent: pass diff --git a/tests/test_renderers.py b/tests/test_renderers.py index db8b3b4f2..7bbf8565c 100644 --- a/tests/test_renderers.py +++ b/tests/test_renderers.py @@ -63,7 +63,7 @@ class TestJSON(unittest.TestCase): self.assertEqual(result, '{"a": "%s"}' % now.isoformat()) def test_with_custom_serializer(self): - class Serializer(object): + class Serializer: def __call__(self, obj, **kw): self.obj = obj self.kw = kw @@ -82,7 +82,7 @@ class TestJSON(unittest.TestCase): request = testing.DummyRequest() outerself = self - class MyObject(object): + class MyObject: def __init__(self, x): self.x = x @@ -96,7 +96,7 @@ class TestJSON(unittest.TestCase): self.assertEqual(result, '[{"x": 1}, {"x": 2}]') def test_with_object_adapter_no___json__(self): - class MyObject(object): + class MyObject: def __init__(self, x): self.x = x @@ -163,14 +163,14 @@ class TestRendererHelper(unittest.TestCase): verifyObject(IRendererInfo, helper) def test_settings_registry_settings_is_None(self): - class Dummy(object): + class Dummy: settings = None helper = self._makeOne(registry=Dummy) self.assertEqual(helper.settings, {}) def test_settings_registry_name_is_None(self): - class Dummy(object): + class Dummy: settings = None helper = self._makeOne(registry=Dummy) @@ -178,7 +178,7 @@ class TestRendererHelper(unittest.TestCase): self.assertEqual(helper.type, '') def test_settings_registry_settings_is_not_None(self): - class Dummy(object): + class Dummy: settings = {'a': 1} helper = self._makeOne(registry=Dummy) @@ -202,7 +202,7 @@ class TestRendererHelper(unittest.TestCase): def _registerResponseFactory(self): from pyramid.interfaces import IResponseFactory - class ResponseFactory(object): + class ResponseFactory: pass self.config.registry.registerUtility( @@ -254,7 +254,7 @@ class TestRendererHelper(unittest.TestCase): def test_render_explicit_registry(self): factory = self._registerRendererFactory() - class DummyRegistry(object): + class DummyRegistry: def __init__(self): self.responses = [factory, lambda *arg: {}, None] @@ -372,7 +372,7 @@ class TestRendererHelper(unittest.TestCase): def test_with_alternate_response_factory(self): from pyramid.interfaces import IResponseFactory - class ResponseFactory(object): + class ResponseFactory: def __init__(self): pass @@ -560,7 +560,7 @@ class Test_render(unittest.TestCase): def test_no_response_to_preserve(self): from pyramid.decorator import reify - class DummyRequestWithClassResponse(object): + class DummyRequestWithClassResponse: _response = DummyResponse() _response.content_type = None _response.default_content_type = None @@ -639,7 +639,7 @@ class Test_render_to_response(unittest.TestCase): def test_no_response_to_preserve(self): from pyramid.decorator import reify - class DummyRequestWithClassResponse(object): + class DummyRequestWithClassResponse: _response = DummyResponse() _response.content_type = None _response.default_content_type = None @@ -655,7 +655,7 @@ class Test_render_to_response(unittest.TestCase): self.assertFalse('response' in request.__dict__) def test_custom_response_object(self): - class DummyRequestWithClassResponse(object): + class DummyRequestWithClassResponse: pass request = DummyRequestWithClassResponse() diff --git a/tests/test_request.py b/tests/test_request.py index 3c5535b0e..70ec32529 100644 --- a/tests/test_request.py +++ b/tests/test_request.py @@ -26,7 +26,7 @@ class TestRequest(unittest.TestCase): from pyramid.interfaces import IResourceURL from zope.interface import Interface - class DummyResourceURL(object): + class DummyResourceURL: def __init__(self, context, request): self.physical_path = '/context/' self.virtual_path = '/context/' @@ -311,7 +311,7 @@ class TestRequest(unittest.TestCase): def adapter(ob): return object() - class Foo(object): + class Foo: pass foo = Foo() @@ -324,7 +324,7 @@ class TestRequest(unittest.TestCase): request = self._makeOne() request.registry = self.config.registry - class Foo(object): + class Foo: pass foo = Foo() @@ -695,11 +695,11 @@ class TestRequestLocalCache(unittest.TestCase): self.assertRaises(ValueError, cache.get_or_create, req) -class Dummy(object): +class Dummy: pass -class DummyRequest(object): +class DummyRequest: def __init__(self, environ=None): if environ is None: environ = {} diff --git a/tests/test_response.py b/tests/test_response.py index 4371d867f..07456818f 100644 --- a/tests/test_response.py +++ b/tests/test_response.py @@ -78,7 +78,7 @@ class TestFileResponse(unittest.TestCase): from pyramid import response from pyramid.util import text_ - class FakeMimetypesModule(object): + class FakeMimetypesModule: def guess_type(self, *arg, **kw): return text_('foo/bar'), None @@ -218,11 +218,11 @@ class TestGetResponseFactory(unittest.TestCase): self.assertTrue(isinstance(response, Response)) -class Dummy(object): +class Dummy: pass -class DummyConfigurator(object): +class DummyConfigurator: def __init__(self): self.adapters = [] @@ -230,7 +230,7 @@ class DummyConfigurator(object): self.adapters.append((wrapped, type_or_iface)) -class DummyVenusian(object): +class DummyVenusian: def __init__(self): self.attached = [] diff --git a/tests/test_router.py b/tests/test_router.py index 6fa9f9a5b..63d9b4238 100644 --- a/tests/test_router.py +++ b/tests/test_router.py @@ -153,7 +153,7 @@ class TestRouter(unittest.TestCase): def test_request_factory(self): from pyramid.interfaces import IRequestFactory - class DummyRequestFactory(object): + class DummyRequestFactory: pass self.registry.registerUtility(DummyRequestFactory, IRequestFactory) @@ -378,7 +378,7 @@ class TestRouter(unittest.TestCase): context = DummyContext() self._registerTraverserFactory(context) - class Extensions(object): + class Extensions: def __init__(self): self.methods = {} self.descriptors = {} @@ -1642,7 +1642,7 @@ class TestRouter(unittest.TestCase): self.assertEqual(result[1], None) -class DummyPredicate(object): +class DummyPredicate: def __call__(self, info, request): return True @@ -1685,7 +1685,7 @@ class DummyStartResponse: @implementer(IResponse) -class DummyResponse(object): +class DummyResponse: headerlist = () app_iter = () environ = None diff --git a/tests/test_scripting.py b/tests/test_scripting.py index b8a18f57e..1ba82d74c 100644 --- a/tests/test_scripting.py +++ b/tests/test_scripting.py @@ -213,7 +213,7 @@ class Dummy: dummy_root = Dummy() -class DummyFactory(object): +class DummyFactory: @classmethod def blank(cls, path): req = DummyRequest({'path': path}) @@ -224,7 +224,7 @@ class DummyFactory(object): self.kw = kw -class DummyRegistry(object): +class DummyRegistry: def __init__(self, utilities): self.utilities = utilities @@ -243,7 +243,7 @@ class DummyApp: return dummy_root -class DummyRequest(object): +class DummyRequest: matchdict = None matched_route = None diff --git a/tests/test_scripts/dummy.py b/tests/test_scripts/dummy.py index 4a848e043..5768f071e 100644 --- a/tests/test_scripts/dummy.py +++ b/tests/test_scripts/dummy.py @@ -3,7 +3,7 @@ from zope.interface import implementer from pyramid.interfaces import IMultiView -class DummyTweens(object): +class DummyTweens: def __init__(self, implicit, explicit): self._implicit = implicit self.explicit = explicit @@ -20,7 +20,7 @@ class Dummy: dummy_root = Dummy() -class DummyRegistry(object): +class DummyRegistry: settings = {} def queryUtility(self, iface, default=None, name=''): @@ -30,7 +30,7 @@ class DummyRegistry(object): dummy_registry = DummyRegistry() -class DummyShell(object): +class DummyShell: env = {} help = '' called = False @@ -54,7 +54,7 @@ class DummyApp: self.registry = dummy_registry -class DummyMapper(object): +class DummyMapper: def __init__(self, *routes): self.routes = routes @@ -62,7 +62,7 @@ class DummyMapper(object): return self.routes -class DummyRoute(object): +class DummyRoute: def __init__( self, name, pattern, factory=None, matchdict=None, predicate=None ): @@ -91,7 +91,7 @@ class DummyRequest: self.matchdict = {} -class DummyView(object): +class DummyView: def __init__(self, **attrs): self.__request_attrs__ = attrs @@ -100,18 +100,18 @@ class DummyView(object): @implementer(IMultiView) -class DummyMultiView(object): +class DummyMultiView: def __init__(self, *views, **attrs): self.views = [(None, view, None) for view in views] self.__request_attrs__ = attrs -class DummyCloser(object): +class DummyCloser: def __call__(self): self.called = True -class DummyBootstrap(object): +class DummyBootstrap: def __init__( self, app=None, @@ -154,7 +154,7 @@ class DummyBootstrap(object): } -class DummyEntryPoint(object): +class DummyEntryPoint: def __init__(self, name, module): self.name = name self.module = module @@ -163,7 +163,7 @@ class DummyEntryPoint(object): return self.module -class DummyPkgResources(object): +class DummyPkgResources: def __init__(self, entry_point_values): self.entry_points = [] @@ -174,13 +174,13 @@ class DummyPkgResources(object): return self.entry_points -class dummy_setup_logging(object): +class dummy_setup_logging: def __call__(self, config_uri, global_conf): self.config_uri = config_uri self.defaults = global_conf -class DummyLoader(object): +class DummyLoader: def __init__( self, settings=None, app_settings=None, app=None, server=None ): diff --git a/tests/test_scripts/test_pdistreport.py b/tests/test_scripts/test_pdistreport.py index 031a6ff2b..079722734 100644 --- a/tests/test_scripts/test_pdistreport.py +++ b/tests/test_scripts/test_pdistreport.py @@ -64,7 +64,7 @@ class TestPDistReportCommand(unittest.TestCase): ) -class DummyPkgResources(object): +class DummyPkgResources: def __init__(self, working_set=()): self.working_set = working_set @@ -72,12 +72,12 @@ class DummyPkgResources(object): return Version('1') -class Version(object): +class Version: def __init__(self, version): self.version = version -class DummyDistribution(object): +class DummyDistribution: def __init__(self, name): self.project_name = name self.version = '1' diff --git a/tests/test_scripts/test_proutes.py b/tests/test_scripts/test_proutes.py index 6ba02a7d4..a585a02aa 100644 --- a/tests/test_scripts/test_proutes.py +++ b/tests/test_scripts/test_proutes.py @@ -4,7 +4,7 @@ import unittest from . import dummy -class DummyIntrospector(object): +class DummyIntrospector: def __init__(self): self.relations = {} self.introspectables = {} diff --git a/tests/test_scripts/test_pshell.py b/tests/test_scripts/test_pshell.py index 10a9cd593..de7e17496 100644 --- a/tests/test_scripts/test_pshell.py +++ b/tests/test_scripts/test_pshell.py @@ -27,7 +27,7 @@ class TestPShellCommand(unittest.TestCase): cmd.get_config_loader = self.loader if patch_args: - class Args(object): + class Args: pass self.args = Args() @@ -35,7 +35,7 @@ class TestPShellCommand(unittest.TestCase): cmd.args.config_uri = self.args.config_uri if patch_options: - class Options(object): + class Options: pass self.options = Options() diff --git a/tests/test_scripts/test_pviews.py b/tests/test_scripts/test_pviews.py index b462b6f28..fb809fdcd 100644 --- a/tests/test_scripts/test_pviews.py +++ b/tests/test_scripts/test_pviews.py @@ -51,7 +51,7 @@ class TestPViewsCommand(unittest.TestCase): registry = Registry() @implementer(IMultiView) - class View1(object): + class View1: pass request = dummy.DummyRequest() @@ -105,7 +105,7 @@ class TestPViewsCommand(unittest.TestCase): registry = Registry() @implementer(IMultiView) - class View1(object): + class View1: pass request = dummy.DummyRequest() @@ -147,7 +147,7 @@ class TestPViewsCommand(unittest.TestCase): registry.registerUtility(IMyRoute, IRouteRequest, name='a') @implementer(IMyRoot) - class Factory(object): + class Factory: def __init__(self, request): pass @@ -190,7 +190,7 @@ class TestPViewsCommand(unittest.TestCase): registry.registerUtility(IMyRoute2, IRouteRequest, name='b') @implementer(IMyRoot) - class Factory(object): + class Factory: def __init__(self, request): pass @@ -242,7 +242,7 @@ class TestPViewsCommand(unittest.TestCase): registry.registerUtility(IMyRoute2, IRouteRequest, name='b') @implementer(IMyRoot) - class Factory(object): + class Factory: def __init__(self, request): pass diff --git a/tests/test_security.py b/tests/test_security.py index db5861562..fdd5288d8 100644 --- a/tests/test_security.py +++ b/tests/test_security.py @@ -248,7 +248,7 @@ class TestViewExecutionPermitted(unittest.TestCase): from pyramid.interfaces import ISecuredView from pyramid.interfaces import IViewClassifier - class Checker(object): + class Checker: def __permitted__(self, context, request): self.context = context self.request = request @@ -277,7 +277,7 @@ class TestViewExecutionPermitted(unittest.TestCase): context = DummyContext() request = testing.DummyRequest({}) - class DummyView(object): + class DummyView: pass view = DummyView() diff --git a/tests/test_session.py b/tests/test_session.py index 8f646658e..94626a733 100644 --- a/tests/test_session.py +++ b/tests/test_session.py @@ -6,7 +6,7 @@ import unittest from pyramid import testing -class SharedCookieSessionTests(object): +class SharedCookieSessionTests: def test_ctor_no_cookie(self): request = testing.DummyRequest() session = self._makeOne(request) @@ -603,11 +603,11 @@ class TestPickleSerializer(unittest.TestCase): self.assertIsInstance(result, bytes) -class Dummy(object): +class Dummy: pass -class DummySerializer(object): +class DummySerializer: def dumps(self, value): return base64.b64encode(json.dumps(value).encode('utf-8')) @@ -634,6 +634,6 @@ class DummySessionFactory(dict): self._dirty = True -class DummyResponse(object): +class DummyResponse: def __init__(self): self.headerlist = [] diff --git a/tests/test_static.py b/tests/test_static.py index 7b6e74a64..3fc6586e9 100644 --- a/tests/test_static.py +++ b/tests/test_static.py @@ -132,7 +132,7 @@ class Test_static_view_use_subpath_False(unittest.TestCase): inst = self._makeOne('tests:fixtures/static') request = self._makeRequest({'PATH_INFO': '/index.html'}) - class _Wrapper(object): + class _Wrapper: def __init__(self, file, block_size=None): self.file = file self.block_size = block_size diff --git a/tests/test_testing.py b/tests/test_testing.py index dbda76454..5273e7f79 100644 --- a/tests/test_testing.py +++ b/tests/test_testing.py @@ -258,7 +258,7 @@ class TestDummyRequest(unittest.TestCase): registry = Registry('this_test') - class ResponseFactory(object): + class ResponseFactory: pass registry.registerUtility(lambda r: ResponseFactory(), IResponseFactory) @@ -695,7 +695,7 @@ class DummyFactory: """ """ -class DummyRegistry(object): +class DummyRegistry: inited = 0 __name__ = 'name' @@ -703,7 +703,7 @@ class DummyRegistry(object): self.inited = self.inited + 1 -class DummyRendererInfo(object): +class DummyRendererInfo: def __init__(self, kw): self.__dict__.update(kw) diff --git a/tests/test_traversal.py b/tests/test_traversal.py index 8d679b1f7..ec61fa5b8 100644 --- a/tests/test_traversal.py +++ b/tests/test_traversal.py @@ -506,7 +506,7 @@ class FindInterfaceTests(unittest.TestCase): self.assertEqual(result.__name__, 'root') def test_it_class(self): - class DummyRoot(object): + class DummyRoot: def __init__(self, child): self.child = child @@ -870,7 +870,7 @@ class QuotePathSegmentTests(unittest.TestCase): self.assertEqual(result, '12345') def test_other(self): - class Foo(object): + class Foo: def __str__(self): return 'abc' @@ -1188,7 +1188,7 @@ class TestDefaultRootFactory(unittest.TestCase): return self._getTargetClass()(environ) def test_it(self): - class DummyRequest(object): + class DummyRequest: pass root = self._makeOne(DummyRequest()) @@ -1235,7 +1235,7 @@ class Test__join_path_tuple(unittest.TestCase): def make_traverser(result): - class DummyTraverser(object): + class DummyTraverser: def __init__(self, context): self.context = context context.wascontext = True @@ -1247,7 +1247,7 @@ def make_traverser(result): return DummyTraverser -class DummyContext(object): +class DummyContext: __parent__ = None def __init__(self, next=None, name=None): diff --git a/tests/test_url.py b/tests/test_url.py index b61b15d82..0eacd9c20 100644 --- a/tests/test_url.py +++ b/tests/test_url.py @@ -34,7 +34,7 @@ class TestURLMethodsMixin(unittest.TestCase): from pyramid.interfaces import IResourceURL from zope.interface import Interface - class DummyResourceURL(object): + class DummyResourceURL: physical_path = '/context/' virtual_path = '/context/' @@ -1081,7 +1081,7 @@ class Test_route_url(unittest.TestCase): return route_url(route_name, request, *elements, **kw) def _makeRequest(self): - class Request(object): + class Request: def route_url(self, route_name, *elements, **kw): self.route_name = route_name self.elements = elements @@ -1106,7 +1106,7 @@ class Test_route_path(unittest.TestCase): return route_path(route_name, request, *elements, **kw) def _makeRequest(self): - class Request(object): + class Request: def route_path(self, route_name, *elements, **kw): self.route_name = route_name self.elements = elements @@ -1131,7 +1131,7 @@ class Test_resource_url(unittest.TestCase): return resource_url(resource, request, *elements, **kw) def _makeRequest(self): - class Request(object): + class Request: def resource_url(self, resource, *elements, **kw): self.resource = resource self.elements = elements @@ -1156,7 +1156,7 @@ class Test_static_url(unittest.TestCase): return static_url(path, request, **kw) def _makeRequest(self): - class Request(object): + class Request: def static_url(self, path, **kw): self.path = path self.kw = kw @@ -1193,7 +1193,7 @@ class Test_static_path(unittest.TestCase): return static_path(path, request, **kw) def _makeRequest(self): - class Request(object): + class Request: def static_path(self, path, **kw): self.path = path self.kw = kw @@ -1230,7 +1230,7 @@ class Test_current_route_url(unittest.TestCase): return current_route_url(request, *elements, **kw) def _makeRequest(self): - class Request(object): + class Request: def current_route_url(self, *elements, **kw): self.elements = elements self.kw = kw @@ -1253,7 +1253,7 @@ class Test_current_route_path(unittest.TestCase): return current_route_path(request, *elements, **kw) def _makeRequest(self): - class Request(object): + class Request: def current_route_path(self, *elements, **kw): self.elements = elements self.kw = kw @@ -1410,7 +1410,7 @@ class Test_with_route_prefix(unittest.TestCase): assert self.config.route_prefix == 'old_prefix' -class DummyContext(object): +class DummyContext: def __init__(self, next=None): self.next = next diff --git a/tests/test_urldispatch.py b/tests/test_urldispatch.py index 5c48bea01..13cf31b32 100644 --- a/tests/test_urldispatch.py +++ b/tests/test_urldispatch.py @@ -660,17 +660,17 @@ class TestCompileRouteFunctional(unittest.TestCase): self.generates('/foo/:abc_def', {'abc_def': '20'}, '/foo/20') -class DummyContext(object): +class DummyContext: """ """ -class DummyRequest(object): +class DummyRequest: scheme = 'http' def __init__(self, **kw): self.__dict__.update(kw) -class DummyRoute(object): +class DummyRoute: def __init__(self, generator): self.generate = generator diff --git a/tests/test_util.py b/tests/test_util.py index 1553d8e60..93493c683 100644 --- a/tests/test_util.py +++ b/tests/test_util.py @@ -841,7 +841,7 @@ class Test_hide_attrs(unittest.TestCase): def _makeDummy(self): from pyramid.decorator import reify - class Dummy(object): + class Dummy: x = 1 @reify @@ -896,7 +896,7 @@ def dummyfunc(): # pragma: no cover pass -class Dummy(object): +class Dummy: pass @@ -971,55 +971,55 @@ class Test_takes_one_arg(unittest.TestCase): return takes_one_arg(view, attr=attr, argname=argname) def test_requestonly_newstyle_class_no_init(self): - class foo(object): + class foo: """ """ self.assertFalse(self._callFUT(foo)) def test_requestonly_newstyle_class_init_toomanyargs(self): - class foo(object): + class foo: def __init__(self, context, request): """ """ self.assertFalse(self._callFUT(foo)) def test_requestonly_newstyle_class_init_onearg_named_request(self): - class foo(object): + class foo: def __init__(self, request): """ """ self.assertTrue(self._callFUT(foo)) def test_newstyle_class_init_onearg_named_somethingelse(self): - class foo(object): + class foo: def __init__(self, req): """ """ self.assertTrue(self._callFUT(foo)) def test_newstyle_class_init_defaultargs_firstname_not_request(self): - class foo(object): + class foo: def __init__(self, context, request=None): """ """ self.assertFalse(self._callFUT(foo)) def test_newstyle_class_init_defaultargs_firstname_request(self): - class foo(object): + class foo: def __init__(self, request, foo=1, bar=2): """ """ self.assertTrue(self._callFUT(foo, argname='request')) def test_newstyle_class_init_firstname_request_with_secondname(self): - class foo(object): + class foo: def __init__(self, request, two): """ """ self.assertFalse(self._callFUT(foo)) def test_newstyle_class_init_noargs(self): - class foo(object): + class foo: def __init__(): """ """ @@ -1209,7 +1209,7 @@ class TestSimpleSerializer(unittest.TestCase): class TestUnboundMethods(unittest.TestCase): - class Dummy(object): + class Dummy: def run(self): # pragma: no cover return 'OK' diff --git a/tests/test_view.py b/tests/test_view.py index 710fba76c..3bfad0732 100644 --- a/tests/test_view.py +++ b/tests/test_view.py @@ -6,7 +6,7 @@ from pyramid import testing from pyramid.interfaces import IRequest, IResponse -class BaseTest(object): +class BaseTest: def setUp(self): self.config = testing.setUp() @@ -98,7 +98,7 @@ class Test_notfound_view_config(BaseTest, unittest.TestCase): decorator.venusian = venusian decorator.venusian.info.scope = 'class' - class view(object): + class view: pass wrapped = decorator(view) @@ -170,7 +170,7 @@ class Test_forbidden_view_config(BaseTest, unittest.TestCase): decorator.venusian = venusian decorator.venusian.info.scope = 'class' - class view(object): + class view: pass wrapped = decorator(view) @@ -255,7 +255,7 @@ class Test_exception_view_config(BaseTest, unittest.TestCase): decorator.venusian = venusian decorator.venusian.info.scope = 'class' - class view(object): + class view: pass wrapped = decorator(view) @@ -583,7 +583,7 @@ class TestViewConfigDecorator(unittest.TestCase): decorator.venusian = venusian decorator.venusian.info.scope = 'class' - class foo(object): + class foo: pass wrapped = decorator(foo) @@ -602,7 +602,7 @@ class TestViewConfigDecorator(unittest.TestCase): decorator.venusian = venusian decorator.venusian.info.scope = 'class' - class foo(object): + class foo: pass wrapped = decorator(foo) @@ -649,7 +649,7 @@ class TestViewConfigDecorator(unittest.TestCase): def bar(self): # pragma: no cover pass - class foo(object): + class foo: foomethod = decorator(foo) barmethod = decorator(bar) @@ -715,7 +715,7 @@ class TestViewConfigDecorator(unittest.TestCase): from pyramid.interfaces import IRendererInfo @implementer(IRendererInfo) - class DummyRendererHelper(object): + class DummyRendererHelper: pass renderer_helper = DummyRendererHelper() @@ -785,14 +785,14 @@ class Test_append_slash_notfound_view(BaseTest, unittest.TestCase): def _registerMapper(self, reg, match=True): from pyramid.interfaces import IRoutesMapper - class DummyRoute(object): + class DummyRoute: def __init__(self, val): self.val = val def match(self, path): return self.val - class DummyMapper(object): + class DummyMapper: def __init__(self): self.routelist = [DummyRoute(match)] @@ -919,7 +919,7 @@ class Test_view_defaults(unittest.TestCase): from pyramid.view import view_defaults @view_defaults(route_name='abc', renderer='def') - class Foo(object): + class Foo: pass self.assertEqual(Foo.__view_defaults__['route_name'], 'abc') @@ -929,7 +929,7 @@ class Test_view_defaults(unittest.TestCase): from pyramid.view import view_defaults @view_defaults(route_name='abc', renderer='def') - class Foo(object): + class Foo: pass class Bar(Foo): @@ -942,7 +942,7 @@ class Test_view_defaults(unittest.TestCase): from pyramid.view import view_defaults @view_defaults(route_name='abc', renderer='def') - class Foo(object): + class Foo: pass @view_defaults(route_name='ghi') @@ -956,7 +956,7 @@ class Test_view_defaults(unittest.TestCase): from pyramid.view import view_defaults @view_defaults(route_name='abc', renderer='def') - class Foo(object): + class Foo: pass @view_defaults() @@ -1224,7 +1224,7 @@ class DummyRequest: @implementer(IResponse) -class DummyResponse(object): +class DummyResponse: headerlist = () app_iter = () status = '200 OK' @@ -1241,13 +1241,13 @@ class IContext(Interface): pass -class DummyVenusianInfo(object): +class DummyVenusianInfo: scope = 'notaclass' module = sys.modules['tests'] codeinfo = 'codeinfo' -class DummyVenusian(object): +class DummyVenusian: def __init__(self, info=None): if info is None: info = DummyVenusianInfo() @@ -1259,11 +1259,11 @@ class DummyVenusian(object): return self.info -class DummyRegistry(object): +class DummyRegistry: pass -class DummyConfig(object): +class DummyConfig: def __init__(self): self.settings = [] self.registry = DummyRegistry() @@ -1278,7 +1278,7 @@ class DummyConfig(object): return self -class DummyVenusianContext(object): +class DummyVenusianContext: def __init__(self): self.config = DummyConfig() diff --git a/tests/test_viewderivers.py b/tests/test_viewderivers.py index 0e2881683..4e871ad4a 100644 --- a/tests/test_viewderivers.py +++ b/tests/test_viewderivers.py @@ -73,7 +73,7 @@ class TestDeriveView(unittest.TestCase): raise AssertionError def test_instance_returns_non_adaptable(self): - class AView(object): + class AView: def __call__(self, request): return None @@ -129,7 +129,7 @@ class TestDeriveView(unittest.TestCase): def test_requestonly_default_method_returns_non_adaptable(self): request = DummyRequest() - class AView(object): + class AView: def __init__(self, request): pass @@ -155,7 +155,7 @@ class TestDeriveView(unittest.TestCase): def test_requestonly_nondefault_method_returns_non_adaptable(self): request = DummyRequest() - class AView(object): + class AView: def __init__(self, request): pass @@ -191,7 +191,7 @@ class TestDeriveView(unittest.TestCase): def test_requestonly_function_with_renderer(self): response = DummyResponse() - class moo(object): + class moo: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, 'OK') @@ -235,7 +235,7 @@ class TestDeriveView(unittest.TestCase): def test_requestonly_function_with_renderer_request_has_view(self): response = DummyResponse() - class moo(object): + class moo: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, 'OK') @@ -261,7 +261,7 @@ class TestDeriveView(unittest.TestCase): def test_class_without_attr(self): response = DummyResponse() - class View(object): + class View: def __init__(self, request): pass @@ -276,7 +276,7 @@ class TestDeriveView(unittest.TestCase): def test_class_with_attr(self): response = DummyResponse() - class View(object): + class View: def __init__(self, request): pass @@ -314,7 +314,7 @@ class TestDeriveView(unittest.TestCase): def test_as_newstyle_class_context_and_request(self): response = DummyResponse() - class view(object): + class view: def __init__(self, context, request): pass @@ -334,7 +334,7 @@ class TestDeriveView(unittest.TestCase): def test_as_newstyle_class_requestonly(self): response = DummyResponse() - class view(object): + class view: def __init__(self, context, request): pass @@ -924,7 +924,7 @@ class TestDeriveView(unittest.TestCase): def test_as_newstyle_class_context_and_request_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -935,7 +935,7 @@ class TestDeriveView(unittest.TestCase): def clone(self): return self - class View(object): + class View: def __init__(self, context, request): pass @@ -956,7 +956,7 @@ class TestDeriveView(unittest.TestCase): def test_as_newstyle_class_requestonly_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -967,7 +967,7 @@ class TestDeriveView(unittest.TestCase): def clone(self): return self - class View(object): + class View: def __init__(self, request): pass @@ -988,7 +988,7 @@ class TestDeriveView(unittest.TestCase): def test_as_oldstyle_cls_context_request_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -1020,7 +1020,7 @@ class TestDeriveView(unittest.TestCase): def test_as_oldstyle_cls_requestonly_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -1052,7 +1052,7 @@ class TestDeriveView(unittest.TestCase): def test_as_instance_context_and_request_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -1081,7 +1081,7 @@ class TestDeriveView(unittest.TestCase): def test_as_instance_requestonly_attr_and_renderer(self): response = DummyResponse() - class renderer(object): + class renderer: def render_view(inself, req, resp, view_inst, ctx): self.assertEqual(req, request) self.assertEqual(resp, {'a': '1'}) @@ -1110,7 +1110,7 @@ class TestDeriveView(unittest.TestCase): def test_with_view_mapper_config_specified(self): response = DummyResponse() - class mapper(object): + class mapper: def __init__(self, **kw): self.kw = kw @@ -2046,7 +2046,7 @@ class TestDeriverIntegration(unittest.TestCase): @implementer(IResponse) -class DummyResponse(object): +class DummyResponse: content_type = None default_content_type = None body = None diff --git a/tests/test_wsgi.py b/tests/test_wsgi.py index a5a955621..7ef7fc8ef 100644 --- a/tests/test_wsgi.py +++ b/tests/test_wsgi.py @@ -121,7 +121,7 @@ def dummyapp(environ, start_response): """ """ -class DummyApp(object): +class DummyApp: def __call__(self, environ, start_response): """ """ |
