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:
Terry Jan Reedy 2013-06-30 18:37:05 -04:00
parent ef1f777e0a
commit acd5f81149
2 changed files with 39 additions and 2 deletions

View file

@ -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):