diff options
Diffstat (limited to 'tests/run/common_utility_types.srctree')
-rw-r--r-- | tests/run/common_utility_types.srctree | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/tests/run/common_utility_types.srctree b/tests/run/common_utility_types.srctree index 1f3d2aea3..e978accc3 100644 --- a/tests/run/common_utility_types.srctree +++ b/tests/run/common_utility_types.srctree @@ -31,8 +31,21 @@ print("importing...") import a, b print(type(a.funcA)) -assert type(a.funcA).__name__ == 'cython_function_or_method' +assert type(a.funcA).__name__.endswith('cython_function_or_method') assert type(a.funcA) is type(b.funcB) assert a.funcA.func_globals is a.__dict__ assert b.funcB.func_globals is b.__dict__ + +# Test that it's possible to look up the name of the class +from sys import modules +cy_modules = [ mod for n, mod in modules.items() if n.startswith("_cython_") ] +# In principle it's possible to have "_cython_" internal modules for multiple +# different versions of Cython. However, since this is run in an end-to-end test +# with a very short list of imports it should not happen here. +assert(len(cy_modules)==1) +mod = cy_modules[0] + +assert '.' not in type(a.funcA).__name__ +func_t = getattr(mod, type(a.funcA).__name__) +assert func_t is type(a.funcA) |