def test_removeAllProxies_simple(self): obj = IM() # One layer of wrapping of each for wrap in ProxyBase, ContainedProxy, aq_proxied: wrapped = wrap(obj) assert_that(removeAllProxies(wrapped), is_(same_instance(obj)))
def test_removeAllProxies_doubled(self): # double wrapping in weird combos obj = IM() for wrap in ProxyBase, ContainedProxy, aq_proxied: wrapped = wrap(obj) for wrap2 in ContainedProxy, ProxyBase: __traceback_info__ = wrap, wrap2 wrapped = wrap2(wrapped) assert_that(removeAllProxies(wrapped), is_(same_instance(obj)))
def test_removeAllProxies_multiple_wraps(self): from itertools import permutations wrappers = [ProxyBase, ContainedProxy, EC.wrapping] obj = IM() wrapped = obj for permutation in permutations(wrappers): for wrapper in permutation: wrapped = wrapper(wrapped) assert_that(removeAllProxies(wrapped), is_(same_instance(obj)))