Created
October 8, 2018 11:22
-
-
Save justin8/c6a565d3b64222a9ba3a2568d1d830ee to your computer and use it in GitHub Desktop.
Python issue 33643
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Python 3.6.5 (default, Oct 7 2018, 12:37:39) | |
Type "copyright", "credits" or "license" for more information. | |
IPython 5.3.0 -- An enhanced Interactive Python. | |
? -> Introduction and overview of IPython's features. | |
%quickref -> Quick reference. | |
help -> Python's own help system. | |
object? -> Details about 'object', use 'object??' for extra details. | |
In [1]: def foo(a): | |
...: print(a) | |
...: | |
In [2]: import mock | |
In [3]: m = mock.create_autospec(foo) | |
In [4]: m(1,2,3) | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-4-38cc8fd669ee> in <module>() | |
----> 1 m(1,2,3) | |
<string> in foo(*args, **kwargs) | |
/home/jdray/B9/AMI/env/AWSCloud9AMIBuilder-2.0/test-runtime/lib/python3.6/site-packages/mock/mock.py in checksig(*args, **kwargs) | |
290 func, sig = result | |
291 def checksig(*args, **kwargs): | |
--> 292 sig.bind(*args, **kwargs) | |
293 _copy_func_details(func, checksig) | |
294 | |
/home/jdray/B9/AMI/env/AWSCloud9AMIBuilder-2.0/test-runtime/python3.6/lib/python3.6/inspect.py in bind(*args, **kwargs) | |
2967 if the passed arguments can not be bound. | |
2968 """ | |
-> 2969 return args[0]._bind(args[1:], kwargs) | |
2970 | |
2971 def bind_partial(*args, **kwargs): | |
/home/jdray/B9/AMI/env/AWSCloud9AMIBuilder-2.0/test-runtime/python3.6/lib/python3.6/inspect.py in _bind(self, args, kwargs, partial) | |
2888 param = next(parameters) | |
2889 except StopIteration: | |
-> 2890 raise TypeError('too many positional arguments') from None | |
2891 else: | |
2892 if param.kind in (_VAR_KEYWORD, _KEYWORD_ONLY): | |
TypeError: too many positional arguments | |
In [5]: m(1) | |
Out[5]: <MagicMock name='mock()' id='139641359789976'> | |
In [6]: | |
In [6]: m.assert_called() | |
--------------------------------------------------------------------------- | |
AttributeError Traceback (most recent call last) | |
<ipython-input-6-619a51b5b3c6> in <module>() | |
----> 1 m.assert_called() | |
AttributeError: 'function' object has no attribute 'assert_called' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment