Andrei Kulakov <andrei....@gmail.com> added the comment:
I forgot to include example of the breakage: >>> m=Mock(name=1) >>> m Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ak/opensource/cpython2/Lib/unittest/mock.py", line 735, in __repr__ name = self._extract_mock_name() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ak/opensource/cpython2/Lib/unittest/mock.py", line 732, in _extract_mock_name return ''.join(_name_list) ^^^^^^^^^^^^^^^^^^^ TypeError: sequence item 0: expected str instance, int found >>> m=Mock(parent='foo') >>> m Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/Users/ak/opensource/cpython2/Lib/unittest/mock.py", line 735, in __repr__ name = self._extract_mock_name() ^^^^^^^^^^^^^^^^^^^^^^^^^ File "/Users/ak/opensource/cpython2/Lib/unittest/mock.py", line 719, in _extract_mock_name _name_list.append(_parent._mock_new_name + dot) ^^^^^^^^^^^^^^^^^^^^^^ AttributeError: 'str' object has no attribute '_mock_new_name' ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue45215> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com