$13 GRAYBYTE WORDPRESS FILE MANAGER $74

SERVER : vnpttt-amd7f72-h1.vietnix.vn #1 SMP Fri May 24 12:42:50 UTC 2024
SERVER IP : 103.200.23.149 | ADMIN IP 216.73.216.22
OPTIONS : CRL = ON | WGT = ON | SDO = OFF | PKEX = OFF
DEACTIVATED : NONE

/opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/tests/

HOME
Current File : /opt/cloudlinux/venv/lib/python3.11/site-packages/numpy/tests//test_lazyloading.py
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)

Current_dir [ NOT WRITEABLE ] Document_root [ WRITEABLE ]


[ Back ]
NAME
SIZE
LAST TOUCH
USER
CAN-I?
FUNCTIONS
..
--
14 Aug 2025 9.24 PM
root / root
0755
__pycache__
--
14 Aug 2025 9.24 PM
root / root
0755
__init__.py
0 KB
17 Apr 2025 8.10 PM
root / root
0644
test__all__.py
0.216 KB
17 Apr 2025 8.10 PM
root / root
0644
test_ctypeslib.py
12.002 KB
17 Apr 2025 8.10 PM
root / root
0644
test_lazyloading.py
1.135 KB
17 Apr 2025 8.10 PM
root / root
0644
test_matlib.py
1.809 KB
17 Apr 2025 8.10 PM
root / root
0644
test_numpy_config.py
1.212 KB
17 Apr 2025 8.10 PM
root / root
0644
test_numpy_version.py
1.538 KB
17 Apr 2025 8.10 PM
root / root
0644
test_public_api.py
16.477 KB
17 Apr 2025 8.10 PM
root / root
0644
test_reloading.py
2.299 KB
17 Apr 2025 8.10 PM
root / root
0644
test_scripts.py
1.606 KB
17 Apr 2025 8.10 PM
root / root
0644
test_warnings.py
2.227 KB
17 Apr 2025 8.10 PM
root / root
0644

GRAYBYTE WORDPRESS FILE MANAGER @ 2026 CONTACT ME
Static GIF