()
| 31 | |
| 32 | |
| 33 | def test_numpy_namespace(): |
| 34 | # None of these objects are publicly documented to be part of the main |
| 35 | # NumPy namespace (some are useful though, others need to be cleaned up) |
| 36 | undocumented = { |
| 37 | '_add_newdoc_ufunc': 'numpy.core._multiarray_umath._add_newdoc_ufunc', |
| 38 | 'add_docstring': 'numpy.core._multiarray_umath.add_docstring', |
| 39 | 'add_newdoc': 'numpy.core.function_base.add_newdoc', |
| 40 | 'add_newdoc_ufunc': 'numpy.core._multiarray_umath._add_newdoc_ufunc', |
| 41 | 'byte_bounds': 'numpy.lib.utils.byte_bounds', |
| 42 | 'compare_chararrays': 'numpy.core._multiarray_umath.compare_chararrays', |
| 43 | 'deprecate': 'numpy.lib.utils.deprecate', |
| 44 | 'deprecate_with_doc': 'numpy.lib.utils.deprecate_with_doc', |
| 45 | 'disp': 'numpy.lib.function_base.disp', |
| 46 | 'fastCopyAndTranspose': 'numpy.core._multiarray_umath.fastCopyAndTranspose', |
| 47 | 'get_array_wrap': 'numpy.lib.shape_base.get_array_wrap', |
| 48 | 'get_include': 'numpy.lib.utils.get_include', |
| 49 | 'recfromcsv': 'numpy.lib.npyio.recfromcsv', |
| 50 | 'recfromtxt': 'numpy.lib.npyio.recfromtxt', |
| 51 | 'safe_eval': 'numpy.lib.utils.safe_eval', |
| 52 | 'set_string_function': 'numpy.core.arrayprint.set_string_function', |
| 53 | 'show_config': 'numpy.__config__.show', |
| 54 | 'show_runtime': 'numpy.lib.utils.show_runtime', |
| 55 | 'who': 'numpy.lib.utils.who', |
| 56 | } |
| 57 | # We override dir to not show these members |
| 58 | allowlist = undocumented |
| 59 | bad_results = check_dir(np) |
| 60 | # pytest gives better error messages with the builtin assert than with |
| 61 | # assert_equal |
| 62 | assert bad_results == allowlist |
| 63 | |
| 64 | |
| 65 | @pytest.mark.skipif(IS_WASM, reason="can't start subprocess") |
nothing calls this directly
no test coverage detected