From f5972235f11e10170095c83a05995f5943c6ef56 Mon Sep 17 00:00:00 2001 From: Paul McCarthy <pauldmccarthy@gmail.com> Date: Wed, 31 Jan 2018 11:00:11 +0000 Subject: [PATCH] Weakfuncref test --- tests/test_weakfuncref.py | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/tests/test_weakfuncref.py b/tests/test_weakfuncref.py index 237321818..58ce3974d 100644 --- a/tests/test_weakfuncref.py +++ b/tests/test_weakfuncref.py @@ -21,7 +21,19 @@ def make_weakfuncref_method_that_will_get_gcd(): def method(self): pass - return weakfuncref.WeakFunctionRef(Thing.method) + return weakfuncref.WeakFunctionRef(Thing.method) + + +def test_weakfuncref_call(): + + def func(): + pass + + non_gcd_func = weakfuncref.WeakFunctionRef(func) + gcd_func = make_weakfuncref_that_will_get_gcd() + + assert gcd_func() is None + assert non_gcd_func() is func def test_weakfuncref_function(): @@ -43,11 +55,11 @@ def test_weakfuncref_method(): return 'existent!' def __priv_method(self): - return 'existent!' - + return 'existent!' + @classmethod def clsmethod(clsself): - return 'existent!' + return 'existent!' t = Thing() -- GitLab