From 0109711792b0735488342b7e3efe4ee1fb303dbd Mon Sep 17 00:00:00 2001 From: Michael Merickel <michael@merickel.org> Date: Sat, 08 Jul 2017 19:08:59 +0200 Subject: [PATCH] add _depth and _category arguments to all decorators --- pyramid/tests/test_response.py | 21 ++++++++++++++++----- 1 files changed, 16 insertions(+), 5 deletions(-) diff --git a/pyramid/tests/test_response.py b/pyramid/tests/test_response.py index ad55882..53e3ce1 100644 --- a/pyramid/tests/test_response.py +++ b/pyramid/tests/test_response.py @@ -136,9 +136,9 @@ def tearDown(self): self.config.end() - def _makeOne(self, *types_or_ifaces): + def _makeOne(self, *types_or_ifaces, **kw): from pyramid.response import response_adapter - return response_adapter(*types_or_ifaces) + return response_adapter(*types_or_ifaces, **kw) def test_register_single(self): from zope.interface import Interface @@ -172,7 +172,18 @@ def foo(): pass dec(foo) self.assertEqual(dummy_venusian.attached, - [(foo, dec.register, 'pyramid')]) + [(foo, dec.register, 'pyramid', 1)]) + + def test___call___with_venusian_args(self): + from zope.interface import Interface + class IFoo(Interface): pass + dec = self._makeOne(IFoo, _category='foo', _depth=1) + dummy_venusian = DummyVenusian() + dec.venusian = dummy_venusian + def foo(): pass + dec(foo) + self.assertEqual(dummy_venusian.attached, + [(foo, dec.register, 'foo', 2)]) class TestGetResponseFactory(unittest.TestCase): @@ -199,5 +210,5 @@ def __init__(self): self.attached = [] - def attach(self, wrapped, fn, category=None): - self.attached.append((wrapped, fn, category)) + def attach(self, wrapped, fn, category=None, depth=None): + self.attached.append((wrapped, fn, category, depth)) -- Gitblit v1.9.3