Tom Dalton <[email protected]> added the comment:
Here's a minimal example so my comment is not totally vacuous:
```
import unittest
from unittest import mock
class Foo:
@classmethod
def bar(cls, baz):
pass
class TestFoo(unittest.TestCase):
def test_bar(self):
with unittest.mock.patch.object(Foo, "bar", autospec=True):
Foo.bar()
```
->
```
~/› python -m unittest example.py
E
======================================================================
ERROR: test_bar (example.TestFoo)
----------------------------------------------------------------------
Traceback (most recent call last):
File "example.py", line 14, in test_bar
Foo.bar()
TypeError: 'NonCallableMagicMock' object is not callable
----------------------------------------------------------------------
Ran 1 test in 0.001s
```
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue23078>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com