diff options
author | Mario Corchero <mariocj89@gmail.com> | 2019-04-30 18:56:36 (GMT) |
---|---|---|
committer | Chris Withers <chris@withers.org> | 2019-04-30 18:56:36 (GMT) |
commit | 0df635c7f8aa69e56a092bd4f142f0f164741ab2 (patch) | |
tree | fc549b19dcdcfc45a85512165ac3e05eec428e9a /Misc | |
parent | d537ab0ff9767ef024f26246899728f0116b1ec3 (diff) | |
download | cpython-0df635c7f8aa69e56a092bd4f142f0f164741ab2.zip cpython-0df635c7f8aa69e56a092bd4f142f0f164741ab2.tar.gz cpython-0df635c7f8aa69e56a092bd4f142f0f164741ab2.tar.bz2 |
Don't report deleted attributes in __dir__ (GH#10148)
When an attribute is deleted from a Mock, a sentinel is added rather
than just deleting the attribute. This commit checks for such sentinels
when returning the child mocks in the __dir__ method as users won't
expect deleted attributes to appear when performing dir(mock).
Diffstat (limited to 'Misc')
-rw-r--r-- | Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst b/Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst new file mode 100644 index 0000000..45a0729 --- /dev/null +++ b/Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst @@ -0,0 +1,2 @@ +Don't return deleted attributes when calling dir on a +:class:`unittest.mock.Mock`. |