From 88870aea25a50a060901a1856999bbc01ba14979 2023-04-22 22:22:49 From: Carlos Cordoba Date: 2023-04-22 22:22:49 Subject: [PATCH] TST: Check that we can get completions for second-level Numpy modules --- diff --git a/IPython/core/tests/test_guarded_eval.py b/IPython/core/tests/test_guarded_eval.py index 905cf3a..6fb321a 100644 --- a/IPython/core/tests/test_guarded_eval.py +++ b/IPython/core/tests/test_guarded_eval.py @@ -568,3 +568,15 @@ def test_assumption_named_tuples_share_getitem(): pass assert A.__getitem__ == B.__getitem__ + + +@dec.skip_without("numpy") +def test_module_access(): + import numpy + + context = limited(numpy=numpy) + assert guarded_eval("numpy.linalg.norm", context) == numpy.linalg.norm + + context = minimal(numpy=numpy) + with pytest.raises(GuardRejection): + guarded_eval("np.linalg.norm", context)