Skip to content

Commit 45e8c51

Browse files
committed
out_name -> repr_name
1 parent 4ac0610 commit 45e8c51

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

array_api_tests/pytest_helpers.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -69,15 +69,15 @@ def assert_dtype(
6969
out_dtype: DataType,
7070
expected: Optional[DataType] = None,
7171
*,
72-
out_name: str = "out.dtype",
72+
repr_name: str = "out.dtype",
7373
):
7474
f_in_dtypes = dh.fmt_types(in_dtypes)
7575
f_out_dtype = dh.dtype_to_name[out_dtype]
7676
if expected is None:
7777
expected = dh.result_type(*in_dtypes)
7878
f_expected = dh.dtype_to_name[expected]
7979
msg = (
80-
f"{out_name}={f_out_dtype}, but should be {f_expected} "
80+
f"{repr_name}={f_out_dtype}, but should be {f_expected} "
8181
f"[{func_name}({f_in_dtypes})]"
8282
)
8383
assert out_dtype == expected, msg
@@ -118,15 +118,15 @@ def assert_shape(
118118
out_shape: Union[int, Shape],
119119
expected: Union[int, Shape],
120120
/,
121-
out_name="out.shape",
121+
repr_name="out.shape",
122122
**kw,
123123
):
124124
if isinstance(out_shape, int):
125125
out_shape = (out_shape,)
126126
if isinstance(expected, int):
127127
expected = (expected,)
128128
msg = (
129-
f"{out_name}={out_shape}, but should be {expected} [{func_name}({fmt_kw(kw)})]"
129+
f"{repr_name}={out_shape}, but should be {expected} [{func_name}({fmt_kw(kw)})]"
130130
)
131131
assert out_shape == expected, msg
132132

array_api_tests/test_elementwise_functions.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ def test_bitwise_and(
358358
if not right_is_scalar:
359359
# TODO: generate indices without broadcasting arrays (see test_equal comment)
360360
shape = broadcast_shapes(left.shape, right.shape)
361-
ph.assert_shape(func_name, res.shape, shape, out_name=f"{res_name}.shape")
361+
ph.assert_shape(func_name, res.shape, shape, repr_name=f"{res_name}.shape")
362362
_left = xp.broadcast_to(left, shape)
363363
_right = xp.broadcast_to(right, shape)
364364

@@ -409,7 +409,7 @@ def test_bitwise_left_shift(
409409
# TODO: generate indices without broadcasting arrays (see test_equal comment)
410410
shape = broadcast_shapes(left.shape, right.shape)
411411
ph.assert_shape(
412-
"bitwise_left_shift", res.shape, shape, out_name=f"{res_name}.shape"
412+
"bitwise_left_shift", res.shape, shape, repr_name=f"{res_name}.shape"
413413
)
414414
_left = xp.broadcast_to(left, shape)
415415
_right = xp.broadcast_to(right, shape)
@@ -477,7 +477,7 @@ def test_bitwise_or(
477477
if not right_is_scalar:
478478
# TODO: generate indices without broadcasting arrays (see test_equal comment)
479479
shape = broadcast_shapes(left.shape, right.shape)
480-
ph.assert_shape("bitwise_or", res.shape, shape, out_name=f"{res_name}.shape")
480+
ph.assert_shape("bitwise_or", res.shape, shape, repr_name=f"{res_name}.shape")
481481
_left = xp.broadcast_to(left, shape)
482482
_right = xp.broadcast_to(right, shape)
483483

@@ -528,7 +528,7 @@ def test_bitwise_right_shift(
528528
# TODO: generate indices without broadcasting arrays (see test_equal comment)
529529
shape = broadcast_shapes(left.shape, right.shape)
530530
ph.assert_shape(
531-
"bitwise_right_shift", res.shape, shape, out_name=f"{res_name}.shape"
531+
"bitwise_right_shift", res.shape, shape, repr_name=f"{res_name}.shape"
532532
)
533533
_left = xp.broadcast_to(left, shape)
534534
_right = xp.broadcast_to(right, shape)
@@ -568,7 +568,7 @@ def test_bitwise_xor(
568568
if not right_is_scalar:
569569
# TODO: generate indices without broadcasting arrays (see test_equal comment)
570570
shape = broadcast_shapes(left.shape, right.shape)
571-
ph.assert_shape("bitwise_xor", res.shape, shape, out_name=f"{res_name}.shape")
571+
ph.assert_shape("bitwise_xor", res.shape, shape, repr_name=f"{res_name}.shape")
572572
_left = xp.broadcast_to(left, shape)
573573
_right = xp.broadcast_to(right, shape)
574574

array_api_tests/test_type_promotion.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
@given(hh.mutually_promotable_dtypes(None))
2626
def test_result_type(dtypes):
2727
out = xp.result_type(*dtypes)
28-
ph.assert_dtype("result_type", dtypes, out, out_name="out")
28+
ph.assert_dtype("result_type", dtypes, out, repr_name="out")
2929

3030

3131
# The number and size of generated arrays is arbitrarily limited to prevent
@@ -48,7 +48,7 @@ def test_meshgrid(dtypes, data):
4848
assert math.prod(x.size for x in arrays) <= hh.MAX_ARRAY_SIZE # sanity check
4949
out = xp.meshgrid(*arrays)
5050
for i, x in enumerate(out):
51-
ph.assert_dtype("meshgrid", dtypes, x.dtype, out_name=f"out[{i}].dtype")
51+
ph.assert_dtype("meshgrid", dtypes, x.dtype, repr_name=f"out[{i}].dtype")
5252

5353

5454
@given(
@@ -312,7 +312,7 @@ def test_inplace_op_promotion(op, expr, in_dtypes, out_dtype, shapes, data):
312312
except OverflowError:
313313
reject()
314314
x1 = locals_["x1"]
315-
ph.assert_dtype(op, in_dtypes, x1.dtype, out_dtype, out_name="x1.dtype")
315+
ph.assert_dtype(op, in_dtypes, x1.dtype, out_dtype, repr_name="x1.dtype")
316316

317317

318318
op_scalar_params: List[Param[str, str, DataType, ScalarType, DataType]] = []
@@ -381,7 +381,7 @@ def test_inplace_op_scalar_promotion(op, expr, dtype, in_stype, data):
381381
reject()
382382
x = locals_["x"]
383383
assert x.dtype == dtype, f"{x.dtype=!s}, but should be {dtype}"
384-
ph.assert_dtype(op, (dtype, in_stype), x.dtype, dtype, out_name="x.dtype")
384+
ph.assert_dtype(op, (dtype, in_stype), x.dtype, dtype, repr_name="x.dtype")
385385

386386

387387
if __name__ == "__main__":

0 commit comments

Comments
 (0)