OXIESEC PANEL
- Current Dir:
/
/
var
/
www
/
reader
/
hps
/
faces
/
faces
/
lib
/
python3.10
/
site-packages
/
numpy
/
tests
Server IP: 139.59.38.164
Upload:
Create Dir:
Name
Size
Modified
Perms
📁
..
-
10/26/2024 01:27:22 PM
rwxr-xr-x
📄
__init__.py
0 bytes
10/26/2024 01:27:21 PM
rw-r--r--
📁
__pycache__
-
10/26/2024 01:28:24 PM
rwxr-xr-x
📄
test__all__.py
221 bytes
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_ctypeslib.py
12 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_lazyloading.py
1.13 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_matlib.py
1.81 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_numpy_version.py
1.54 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_public_api.py
15.76 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_reloading.py
2.3 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_scripts.py
1.61 KB
10/26/2024 01:27:21 PM
rw-r--r--
📄
test_warnings.py
2.23 KB
10/26/2024 01:27:21 PM
rw-r--r--
Editing: test_lazyloading.py
Close
import sys import importlib from importlib.util import LazyLoader, find_spec, module_from_spec import pytest # Warning raised by _reload_guard() in numpy/__init__.py @pytest.mark.filterwarnings("ignore:The NumPy module was reloaded") def test_lazy_load(): # gh-22045. lazyload doesn't import submodule names into the namespace # muck with sys.modules to test the importing system old_numpy = sys.modules.pop("numpy") numpy_modules = {} for mod_name, mod in list(sys.modules.items()): if mod_name[:6] == "numpy.": numpy_modules[mod_name] = mod sys.modules.pop(mod_name) try: # create lazy load of numpy as np spec = find_spec("numpy") module = module_from_spec(spec) sys.modules["numpy"] = module loader = LazyLoader(spec.loader) loader.exec_module(module) np = module # test a subpackage import from numpy.lib import recfunctions # test triggering the import of the package np.ndarray finally: if old_numpy: sys.modules["numpy"] = old_numpy sys.modules.update(numpy_modules)