MCPcopy Create free account
hub / github.com/numpy/numpy / test_all_modules_are_expected

Function test_all_modules_are_expected

numpy/tests/test_public_api.py:344–361  ·  view source on GitHub ↗

Test that we don't add anything that looks like a new public module by accident. Check is based on filenames.

()

Source from the content-addressed store, hash-verified

342# suppressing warnings from deprecated modules
343@pytest.mark.filterwarnings("ignore:.*np.compat.*:DeprecationWarning")
344def test_all_modules_are_expected():
345 """
346 Test that we don't add anything that looks like a new public module by
347 accident. Check is based on filenames.
348 """
349
350 modnames = []
351 for _, modname, ispkg in pkgutil.walk_packages(path=np.__path__,
352 prefix=np.__name__ + '.',
353 onerror=None):
354 if is_unexpected(modname) and modname not in SKIP_LIST:
355 # We have a name that is new. If that's on purpose, add it to
356 # PUBLIC_MODULES. We don't expect to have to add anything to
357 # PRIVATE_BUT_PRESENT_MODULES. Use an underscore in the name!
358 modnames.append(modname)
359
360 if modnames:
361 raise AssertionError(f'Found unexpected modules: {modnames}')
362
363
364# Stuff that clearly shouldn't be in the API and is detected by the next test

Callers

nothing calls this directly

Calls 1

is_unexpectedFunction · 0.85

Tested by

no test coverage detected