Skip to content

Commit d264c71

Browse files
committed
Extend the del __wrapped__ test to cover reinitialization.
1 parent 71ab6c6 commit d264c71

File tree

1 file changed

+12
-4
lines changed

1 file changed

+12
-4
lines changed

tests/test_lazy_object_proxy.py

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1622,13 +1622,21 @@ def __qualname__(self):
16221622

16231623

16241624
def test_del_wrapped(lazy_object_proxy):
1625-
class Foo(object):
1626-
pass
1627-
proxy = lazy_object_proxy.Proxy(lambda: Foo)
1625+
foo = object()
1626+
called = []
1627+
1628+
def make_foo():
1629+
called.append(1)
1630+
return foo
1631+
1632+
proxy = lazy_object_proxy.Proxy(make_foo)
16281633
str(proxy)
1629-
assert proxy.__wrapped__
1634+
assert called == [1]
1635+
assert proxy.__wrapped__ is foo
16301636
# print(type(proxy), hasattr(type(proxy), '__wrapped__'))
16311637
del proxy.__wrapped__
1638+
str(proxy)
1639+
assert called == [1, 1]
16321640

16331641

16341642
def test_raise_attribute_error(lazy_object_proxy):

0 commit comments

Comments
 (0)