diff options
author | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2019-06-06 03:39:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-06 03:39:30 -0700 |
commit | 28be388e69c6e88d5c04abcc714db5ec526e4f5e (patch) | |
tree | 8effe3d039ccb38af0ba67be056a16ea65996825 /Misc | |
parent | f62a372928fbf6a2ba722f12f069b75ca6ad16fb (diff) | |
download | cpython-git-28be388e69c6e88d5c04abcc714db5ec526e4f5e.tar.gz |
Don't report deleted attributes in __dir__ (GHGH-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).
(cherry picked from commit 0df635c7f8aa69e56a092bd4f142f0f164741ab2)
Co-authored-by: Mario Corchero <mariocj89@gmail.com>
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 0000000000..45a0729506 --- /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`. |