This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author xtreak
Recipients cjw296, docs@python, florian.brucker, lisroach, mariocj89, michael.foord, xtreak
Date 2020-01-08.10:49:56
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1578480596.59.0.40750208937.issue39222@roundup.psfhosted.org>
In-reply-to
Content
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
History
Date User Action Args
2020-01-08 10:49:56xtreaksetrecipients: + xtreak, cjw296, michael.foord, docs@python, lisroach, mariocj89, florian.brucker
2020-01-08 10:49:56xtreaksetmessageid: <1578480596.59.0.40750208937.issue39222@roundup.psfhosted.org>
2020-01-08 10:49:56xtreaklinkissue39222 messages
2020-01-08 10:49:56xtreakcreate