MCPcopy
hub / github.com/pandas-dev/pandas / test_import_optional

Function test_import_optional

pandas/tests/test_optional_dependency.py:14–22  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

12
13
14def test_import_optional():
15 match = "Import .*notapackage.* pip .* conda .* notapackage"
16 with pytest.raises(ImportError, match=match) as exc_info:
17 import_optional_dependency("notapackage")
18 # The original exception should be there as context:
19 assert isinstance(exc_info.value.__context__, ImportError)
20
21 result = import_optional_dependency("notapackage", errors="ignore")
22 assert result is None
23
24
25def test_xlrd_version_fallback():

Callers

nothing calls this directly

Calls 2

raisesMethod · 0.45

Tested by

no test coverage detected