forked from eriknw/cytoolz
-
Notifications
You must be signed in to change notification settings - Fork 74
Closed
Description
========================================================================================== FAILURES ===========================================================================================
________________________________________________________________________________ test_inspect_wrapped_property ________________________________________________________________________________
def test_inspect_wrapped_property():
class Wrapped(object):
def __init__(self, func):
self.func = func
def __call__(self, *args, **kwargs):
return self.func(*args, **kwargs)
@property
def __wrapped__(self):
return self.func
func = lambda x: x
wrapped = Wrapped(func)
assert inspect.signature(func) == inspect.signature(wrapped)
> assert num_required_args(Wrapped) is None
E AssertionError: assert 1 is None
E + where 1 = num_required_args(<class 'test_inspect_args.test_inspect_wrapped_property.<locals>.Wrapped'>)
test_inspect_args.py:485: AssertionError
_______________________________________________________________________________ test_inspect_signature_property _______________________________________________________________________________
def test_inspect_signature_property():
# By adding AddX to our signature registry, we can inspect the class
# itself and objects of the class. `inspect.signature` doesn't like
# it when `obj.__signature__` is a property.
class AddX(object):
def __init__(self, func):
self.func = func
def __call__(self, addx, *args, **kwargs):
return addx + self.func(*args, **kwargs)
@property
def __signature__(self):
sig = inspect.signature(self.func)
params = list(sig.parameters.values())
kind = inspect.Parameter.POSITIONAL_OR_KEYWORD
newparam = inspect.Parameter('addx', kind)
params = [newparam] + params
return sig.replace(parameters=params)
addx = AddX(lambda x: x)
sig = inspect.signature(addx)
assert sig == inspect.Signature(parameters=[
inspect.Parameter('addx', inspect.Parameter.POSITIONAL_OR_KEYWORD),
inspect.Parameter('x', inspect.Parameter.POSITIONAL_OR_KEYWORD)])
> assert num_required_args(AddX) is False
E AssertionError: assert 1 is False
E + where 1 = num_required_args(<class 'test_inspect_args.test_inspect_signature_property.<locals>.AddX'>)
test_inspect_args.py:463: AssertionError
_____________________________________________________________________________________ test_dev_skip_test ______________________________________________________________________________________
def test_dev_skip_test():
assert dev_skip_test is istest or dev_skip_test is nottest
> assert d.get('istest', False) is True
E AssertionError: assert False is True
E + where False = <built-in method get of dict object at 0x951ef0d40>('istest', False)
E + where <built-in method get of dict object at 0x951ef0d40> = {}.get
test_dev_skip_test.py:20: AssertionError
====================================================================================== warnings summary =======================================================================================
cytoolz/tests/test_tlz.py::test_tlz
/usr/local/lib/python3.9/importlib/__init__.py:127: DeprecationWarning: The toolz.compatibility module is no longer needed in Python 3 and has been deprecated. Please import these utilities directly from the standard library. This module will be removed in a future release.
return _bootstrap._gcd_import(name[level:], package, level)
-- Docs: https://docs.pytest.org/en/stable/how-to/capture-warnings.html
========================================================================== 3 failed, 191 passed, 1 warning in 2.22s ===========================================================================
Version: 0.12.2
Python-3.9
FreeBSD 13.2
Metadata
Metadata
Assignees
Labels
No labels