/opt/imh-python/lib/python3.9/site-packages/IPython/lib/tests
NameSizeModeActions
__pycache__/-0755rm
test.wav441440644editdlrm
test_backgroundjobs.py26980644editdlrm
test_clipboard.py6300644editdlrm
test_deepreload.py18540644editdlrm
test_display.py93130644editdlrm
test_editorhooks.py8840644editdlrm
test_imports.py2730644editdlrm
test_latextools.py57360644editdlrm
test_lexers.py60170644editdlrm
test_pretty.py148900644editdlrm
test_pygments.py8240644editdlrm
__init__.py00644editdlrm
Edit: /opt/imh-python/lib/python3.9/site-packages/IPython/lib/tests/test_deepreload.py (1854B)
# -*- coding: utf-8 -*- """Test suite for the deepreload module.""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. import types from pathlib import Path import pytest from tempfile import TemporaryDirectory from IPython.lib.deepreload import modules_reloading from IPython.lib.deepreload import reload as dreload from IPython.utils.syspathcontext import prepended_to_syspath def test_deepreload(): "Test that dreload does deep reloads and skips excluded modules." with TemporaryDirectory() as tmpdir: with prepended_to_syspath(tmpdir): tmpdirpath = Path(tmpdir) with open(tmpdirpath / "A.py", "w", encoding="utf-8") as f: f.write("class Object:\n pass\nok = True\n") with open(tmpdirpath / "B.py", "w", encoding="utf-8") as f: f.write("import A\nassert A.ok, 'we are fine'\n") import A import B # Test that A is not reloaded. obj = A.Object() dreload(B, exclude=["A"]) assert isinstance(obj, A.Object) is True # Test that an import failure will not blow-up us. A.ok = False with pytest.raises(AssertionError, match="we are fine"): dreload(B, exclude=["A"]) assert len(modules_reloading) == 0 assert not A.ok # Test that A is reloaded. obj = A.Object() A.ok = False dreload(B) assert A.ok assert isinstance(obj, A.Object) is False def test_not_module(): pytest.raises(TypeError, dreload, "modulename") def test_not_in_sys_modules(): fake_module = types.ModuleType("fake_module") with pytest.raises(ImportError, match="not in sys.modules"): dreload(fake_module)