diff options
author | Matthew Barber <quitesimplymatt@gmail.com> | 2021-08-31 19:05:21 +0100 |
---|---|---|
committer | Matthew <quitesimplymatt@gmail.com> | 2021-11-04 09:15:13 +0000 |
commit | f7a392d43286c39013d98b6bdeb93def645fa8ab (patch) | |
tree | 2288e1ddd91214c3730214e1001ccde32dcffd66 /numpy/tests/test_public_api.py | |
parent | df6d2850195eee01046ca9dd2754e57fc2dc82d6 (diff) | |
download | numpy-f7a392d43286c39013d98b6bdeb93def645fa8ab.tar.gz |
Test array_api entry point exists and points to numpy.array_api
Diffstat (limited to 'numpy/tests/test_public_api.py')
-rw-r--r-- | numpy/tests/test_public_api.py | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/numpy/tests/test_public_api.py b/numpy/tests/test_public_api.py index 1e7d389d9..81de66670 100644 --- a/numpy/tests/test_public_api.py +++ b/numpy/tests/test_public_api.py @@ -458,3 +458,19 @@ def test_api_importable(): raise AssertionError("Modules that are not really public but looked " "public and can not be imported: " "{}".format(module_names)) + + +def test_array_api_entry_point(): + """ + Entry point for Array API implementation can be found with importlib and + returns the numpy.array_api namespace. + """ + from numpy import array_api + + eps = importlib.metadata.entry_points() + assert "array_api" in eps.keys() + xp_eps = eps["array_api"] + assert "numpy" in (ep.name for ep in xp_eps) + ep = next(ep for ep in xp_eps if ep.name == "numpy") + xp = importlib.import_module(ep.value) + assert xp is array_api |