Karthikeyan Singaravelan <tir.kar...@gmail.com> added the comment:
It's a similar situation to name argument conflict [0] except that it's parent here. You can use configure_mock or attribute setting to do the same thing like below. parent is discussed in the docs to indicate the attributes being children like "a" being the child of parent "m" as you have mentioned. Adding others for thoughts. >>> from unittest.mock import Mock >>> m = Mock() >>> m.configure_mock(parent=2) >>> m.parent 2 >>> m.a() <Mock name='mock.a()' id='4367727104'> >>> m = Mock() >>> m.parent = 2 >>> m.parent 2 [0] https://docs.python.org/3/library/unittest.mock.html#mock-names-and-the-name-attribute ---------- nosy: +cjw296, lisroach, mariocj89, michael.foord versions: +Python 3.8, Python 3.9 -Python 3.6 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue39222> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com