Skip to content

Commit af9c062

Browse files
committed
Nicer assertion messages in test_eye
1 parent 001d86d commit af9c062

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

array_api_tests/test_creation_functions.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -231,12 +231,14 @@ def test_eye(n_rows, n_cols, kw):
231231
assert_kw_dtype("eye", kw["dtype"], out.dtype)
232232
_n_cols = n_rows if n_cols is None else n_cols
233233
assert_shape("eye", out.shape, (n_rows, _n_cols), n_rows=n_rows, n_cols=n_cols)
234+
f_func = f"[eye({n_rows=}, {n_cols=})]"
234235
for i in range(n_rows):
235236
for j in range(_n_cols):
237+
f_indexed_out = f"out[{i}, {j}]={out[i, j]}"
236238
if j - i == kw.get("k", 0):
237-
assert out[i, j] == 1, f"out[{i}, {j}]={out[i, j]}, should be 1 [eye()]"
239+
assert out[i, j] == 1, f"{f_indexed_out}, should be 1 {f_func}"
238240
else:
239-
assert out[i, j] == 0, f"out[{i}, {j}]={out[i, j]}, should be 0 [eye()]"
241+
assert out[i, j] == 0, f"{f_indexed_out}, should be 0 {f_func}"
240242

241243

242244
default_unsafe_dtypes = [xp.uint64]

0 commit comments

Comments
 (0)