Skip to content

Commit

Permalink
branch coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
mcdonc committed Mar 28, 2011
1 parent 2b701d9 commit f168197
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
7 changes: 5 additions & 2 deletions pyramid/config.py
Expand Up @@ -2949,7 +2949,6 @@ def requestonly(view, attr=None):
return False

args = argspec[0]
defaults = argspec[3]

if hasattr(fn, 'im_func'):
# it's an instance method
Expand All @@ -2962,7 +2961,11 @@ def requestonly(view, attr=None):
if len(args) == 1:
return True

elif args[0] == 'request':
defaults = argspec[3]
if defaults is None:
defaults = ()

if args[0] == 'request':
if len(args) - len(defaults) == 1:
return True

Expand Down
6 changes: 6 additions & 0 deletions pyramid/tests/test_config.py
Expand Up @@ -4407,6 +4407,12 @@ def __init__(self, request, foo=1, bar=2):
""" """
self.assertTrue(self._callFUT(foo))

def test_newstyle_class_init_firstname_request_with_secondname(self):
class foo(object):
def __init__(self, request, two):
""" """
self.assertFalse(self._callFUT(foo))

def test_newstyle_class_init_noargs(self):
class foo(object):
def __init__():
Expand Down

0 comments on commit f168197

Please sign in to comment.