@@ -249,6 +249,31 @@ def test_dir(library, module):
249249 assert not fails , "Missing exports: %s" % fails
250250
251251
252+ @pytest .mark .parametrize ("module" , list (NAMES ))
253+ @pytest .mark .parametrize ("library" , wrapped_libraries )
254+ def test_all (library , module ):
255+ """Test that __all__ isn't missing any exports."""
256+ modname = f"array_api_compat.{ library } "
257+ pytest .importorskip (modname )
258+ if module :
259+ modname += f".{ module } "
260+
261+ objs = {}
262+ exec (f"from { modname } import *" , objs )
263+
264+ missing = set (NAMES [module ]) - objs .keys ()
265+ xfail = set (XFAILS .get ((library , module ), []))
266+
267+ # FIXME are these canonically meant to be in __all__?
268+ if module == "" :
269+ xfail |= {"__array_namespace_info__" , "__array_api_version__" }
270+
271+ xpass = xfail - missing
272+ fails = missing - xfail
273+ assert not xpass , "Names in XFAILS are defined: %s" % xpass
274+ assert not fails , "Missing exports: %s" % fails
275+
276+
252277@pytest .mark .parametrize (
253278 "name" , [name for name in NAMES ["" ] if hasattr (builtins , name )]
254279)
0 commit comments