Undocumented
Constant | PRIVATE_BUT_PRESENT_MODULES |
Undocumented |
Constant | PUBLIC_ALIASED_MODULES |
Undocumented |
Constant | PUBLIC_MODULES |
Undocumented |
Constant | SKIP_LIST |
Undocumented |
Constant | SKIP_LIST_2 |
Undocumented |
Variable | ctypes |
Undocumented |
Function | check_dir |
Returns a mapping of all objects with the wrong __module__ attribute. |
Function | is_unexpected |
Check if this needs to be considered. |
Function | test_all_modules_are_expected |
Test that we don't add anything that looks like a new public module by accident. Check is based on filenames. |
Function | test_all_modules_are_expected_2 |
Method checking all objects. The pkgutil-based method in test_all_modules_are_expected does not catch imports into a namespace, only filenames. So this test is more thorough, and checks this like: |
Function | test_api_importable |
Check that all submodules listed higher up in this file can be imported |
Function | test_array_api_entry_point |
Entry point for Array API implementation can be found with importlib and returns the numpy.array_api namespace. |
Function | test_dir_testing |
Assert that output of dir has only one "testing/tester" attribute without duplicate |
Function | test_import_lazy_import |
Make sure we can actually use the modules we lazy load. |
Function | test_NPY_NO_EXPORT |
Undocumented |
Function | test_numpy_fft |
Undocumented |
Function | test_numpy_linalg |
Undocumented |
Function | test_numpy_namespace |
Undocumented |
Undocumented
Value |
|
Undocumented
Value |
|
list[ str]
=
Undocumented
Value |
|
list[ str]
=
Undocumented
Value |
|
Method checking all objects. The pkgutil-based method in
test_all_modules_are_expected
does not catch imports into a namespace,
only filenames. So this test is more thorough, and checks this like:
import .lib.scimath as emath
To check if something in a module is (effectively) public, one can check if
there's anything in that namespace that's a public function/object but is
not exposed in a higher-level namespace. For example for a numpy.lib
submodule:
mod = np.lib.mixins for obj in mod.__all__: if obj in np.__all__: continue elif obj in np.lib.__all__: continue else: print(obj)
Check that all submodules listed higher up in this file can be imported
Note that if a PRIVATE_BUT_PRESENT_MODULES entry goes missing, it may simply need to be removed from the list (deprecation may or may not be needed - apply common sense).
Make sure we can actually use the modules we lazy load.
While not exported as part of the public API, it was accessible. With the use of __getattr__ and __dir__, this isn't always true It can happen that an infinite recursion may happen.
This is the only way I found that would force the failure to appear on the badly implemented code.
We also test for the presence of the lazily imported modules in dir