mirror of
https://github.com/python/cpython.git
synced 2025-11-03 03:22:27 +00:00
Issue #18189: add test_delegator for Idle Delegator class.
Also change private dict used as a set to a set.
This commit is contained in:
parent
ef1f777e0a
commit
acd5f81149
2 changed files with 39 additions and 2 deletions
|
|
@ -4,12 +4,12 @@ class Delegator:
|
|||
|
||||
def __init__(self, delegate=None):
|
||||
self.delegate = delegate
|
||||
self.__cache = {}
|
||||
self.__cache = set()
|
||||
|
||||
def __getattr__(self, name):
|
||||
attr = getattr(self.delegate, name) # May raise AttributeError
|
||||
setattr(self, name, attr)
|
||||
self.__cache[name] = attr
|
||||
self.__cache.add(name)
|
||||
return attr
|
||||
|
||||
def resetcache(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue