Repository navigation
Incomplete tests: default arguments #439
Copy link
Copy link
Closed
Description
A kind of related to gh-301: I asked GPT5.4 to write a wrapper on top of array-api-strict which, for each function call, looks at the arguments the function is called with, and compares the actual argument with the default value for the corresponding formal parameter. The goal is to find functions where the test suite never generates non-default parameter values.
Then, running the test suite produces the output below.
devicearguments are Test device support #302 (and we cannot easily fix it in the test suite without sacrificing CuPy coverage, cf ENH: Adddevice=arguments to array creation functions cupy/cupy#9848)- the rest could use looking at. The table was recorded from a reasonably short run, so it may very well have false negatives (as in, not all parameter combinations were generated)
+---------------------------+----------------------------------------------------+
| function | arguments |
+---------------------------+----------------------------------------------------+
| Array.__array_namespace__ | api_version=ONLY_DEFAULT_USED |
| arange | device=ONLY_DEFAULT_USED |
| asarray | device=ONLY_DEFAULT_USED |
| astype | device=ONLY_DEFAULT_USED |
| empty_like | device=ONLY_DEFAULT_USED |
| eye | device=ONLY_DEFAULT_USED |
| fft.fftfreq | device=ONLY_DEFAULT_USED |
| fft.rfftfreq | device=ONLY_DEFAULT_USED |
| full | device=ONLY_DEFAULT_USED |
| full_like | device=ONLY_DEFAULT_USED |
| linalg.cholesky | upper=ONLY_DEFAULT_USED |
| linalg.matrix_norm | keepdims=ONLY_DEFAULT_USED |
| linalg.trace | dtype=ONLY_DEFAULT_USED |
| linalg.vector_norm | axis=ONLY_DEFAULT_USED |
| linspace | device=ONLY_DEFAULT_USED |
| ones | device=ONLY_DEFAULT_USED |
| ones_like | device=ONLY_DEFAULT_USED |
| reshape | copy=ONLY_DEFAULT_USED |
| stack | axis=ONLY_DEFAULT_USED |
| sum | axis=ONLY_DEFAULT_USED, keepdims=ONLY_DEFAULT_USED |
| tril | k=ONLY_DEFAULT_USED |
| triu | k=ONLY_DEFAULT_USED |
| zeros | device=ONLY_DEFAULT_USED |
| zeros_like | device=ONLY_DEFAULT_USED |
+---------------------------+----------------------------------------------------+
SQL:
SELECT
CASE
WHEN function LIKE 'recording_backend.%' THEN substr(function,
length('recording_backend.') + 1)
ELSE function
END AS function_name,
group_concat(name || '=' || status, ', ') AS arguments
FROM (
SELECT function, name, status
FROM function_arguments
WHERE status = 'ONLY_DEFAULT_USED'
ORDER BY function, name
) AS filtered
GROUP BY function
ORDER BY function_name;
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
ev-br commentedon Jul 7, 2026
A slightly longer run (with
--max-examples=3_000):Functions with
default onlyparametersFunction names are shown without the
recording_backend.prefix.This report includes only functions with at least one parameter whose status is
default only.Status legend:
required= no default,non-default used= optional and used with a non-default value,default only= optional and only observed at default,default passed explicitly= optional and explicitly passed at its default.Functions listed: 21
Parameters covered: 75
Summary
Array.__array_namespace__api_version(default only);self(required)arangedevice(default only);dtype(non-default used);start(required);step(non-default used);stop(non-default used)asarraycopy(non-default used);device(default only);dtype(non-default used);obj(required)astypecopy(non-default used);device(default only);dtype(required);x(required)empty_likedevice(default only);dtype(non-default used);x(required)eyedevice(default only);dtype(non-default used);k(non-default used);n_cols(non-default used);n_rows(required)fft.fftfreqd(non-default used);device(default only);dtype(non-default used);n(required)fft.rfftfreqd(non-default used);device(default only);dtype(non-default used);n(required)fulldevice(default only);dtype(non-default used);fill_value(required);shape(required)full_likedevice(default only);dtype(non-default used);fill_value(required);x(required)linalg.tracedtype(default only);offset(non-default used);x(required)linspacedevice(default only);dtype(non-default used);endpoint(non-default used);num(required);start(required);stop(required)onesdevice(default only);dtype(non-default used);shape(required)ones_likedevice(default only);dtype(non-default used);x(required)reshapecopy(default only);shape(required);x(required)stdaxis(default only);correction(default passed explicitly);keepdims(default only);x(required)sumaxis(default only);dtype(non-default used);keepdims(default only);x(required)trilk(default only);x(required)triuk(default only);x(required)zerosdevice(default only);dtype(non-default used);shape(required)zeros_likedevice(default only);dtype(non-default used);x(required)Details
Array.__array_namespace__api_versionselfarangedevicedtypestartstepstopasarraycopydevicedtypeobjastypecopydevicedtypexempty_likedevicedtypexeyedevicedtypekn_colsn_rowsfft.fftfreqddevicedtypenfft.rfftfreqddevicedtypenfulldevicedtypefill_valueshapefull_likedevicedtypefill_valuexlinalg.tracedtypeoffsetxlinspacedevicedtypeendpointnumstartstoponesdevicedtypeshapeones_likedevicedtypexreshapecopyshapexstdaxiscorrectionkeepdimsxsumaxisdtypekeepdimsxtrilkxtriukxzerosdevicedtypeshapezeros_likedevicedtypexprady0t commentedon Jul 12, 2026
So, to summarise, apart from the
deviceparameter, these are the functions (and their parameter) with missing coverage?sumaxis,keepdimsstdaxis,keepdims, non-defaultcorrectionreshapecopytrilktriuklinalg.tracedtypeArray.__array_namespace__api_versionprady0t commentedon Jul 12, 2026
I tried to print the generated argument inputs for
sumby addingprint(f"kw = {kw}")hereIIUC, non-default inputs are generated here.
ev-br commentedon Jul 12, 2026
The checker is entirely vibe-coded, so yeah, let's treat what it emits as a hint and check manually other function, too.
prady0t commentedon Jul 12, 2026
Here's an analysis on the rest of the functions:
stddoes generate non-default inputs:test_reshapedoes not account forcopy, indeed:array-api-tests/array_api_tests/test_manipulation_functions.py
Line 432 in 55fcc60
trilandtriuarray-api-tests/array_api_tests/test_signatures.py
Line 150 in 55fcc60
linalg.trace, there is no dtype strategy. See:array-api-tests/array_api_tests/test_linalg.py
Line 925 in 55fcc60
If I try to print generated inputs:
Which means that functions that are missing coverage are:
reshape: missing copytril: missing testtriu: missing testlinalg.trace: missing dtypeev-br commentedon Jul 12, 2026
Thanks!
reshape is #432
The other three would be great to have PRs for indeed.
prady0t commentedon Jul 12, 2026
Since
deviceis already being tracked separately, I'll be happy to open another tracking issue fortriu,trilandlinalg.traceand close this one. Or maybe you can rename this PR title to something more accurate.ev-br commentedon Jul 12, 2026
No need for a separate issue, I'd think. Either a single PR or a sequence, whichever works.
ev-br commentedon Jul 17, 2026
To summarize:
trilandtriu#442 addedtest_trilandtest_triu.dtypeparameter to the test forlinalg.trace#441 addsdtypetotest_trace.reshape'scopy=is blocked at ENH: reshape: test copy= kwarg #432Let's close this.