MCPcopy Index your code
hub / github.com/ipython/ipython / test_external_not_installed

Function test_external_not_installed

tests/test_guarded_eval.py:70–86  ·  view source on GitHub ↗

Because attribute check requires checking if object is not of allowed external type, this tests logic for absence of external module.

()

Source from the content-addressed store, hash-verified

68
69
70def test_external_not_installed():
71 """
72 Because attribute check requires checking if object is not of allowed
73 external type, this tests logic for absence of external module.
74 """
75
76 class Custom:
77 def __init__(self):
78 self.test = 1
79
80 def __getattr__(self, key):
81 return key
82
83 with module_not_installed("pandas"):
84 context = limited(x=Custom())
85 with pytest.raises(GuardRejection):
86 guarded_eval("x.test", context)
87
88
89@dec.skip_without("pandas")

Callers

nothing calls this directly

Calls 3

guarded_evalFunction · 0.90
module_not_installedFunction · 0.85
CustomClass · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…