]> granicus.if.org Git - python/commit
Don't report deleted attributes in __dir__ (GH#10148)
authorMario Corchero <mariocj89@gmail.com>
Tue, 30 Apr 2019 18:56:36 +0000 (19:56 +0100)
committerChris Withers <chris@withers.org>
Tue, 30 Apr 2019 18:56:36 +0000 (19:56 +0100)
commit0df635c7f8aa69e56a092bd4f142f0f164741ab2
treefc549b19dcdcfc45a85512165ac3e05eec428e9a
parentd537ab0ff9767ef024f26246899728f0116b1ec3
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).
Lib/unittest/mock.py
Lib/unittest/test/testmock/testmock.py
Misc/NEWS.d/next/Library/2018-10-27-11-54-12.bpo-35082.HDj1nr.rst [new file with mode: 0644]