Skip to content

Commit 6a89ebe

Browse files
committed
Comment that outlines parametrisation behaviour
1 parent 27a2835 commit 6a89ebe

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

array_api_tests/test_elementwise_functions.py

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,24 @@
2929
# We might as well use this implementation rather than xp.broadcast_shapes()
3030
from .test_broadcasting import broadcast_shapes
3131

32+
33+
# When appropiate, this module tests operators alongside their respective
34+
# elementwise methods. We do this by parametrizing a generalised test method
35+
# with every relevant method and operator.
36+
#
37+
# Notable arguments in the parameter:
38+
# - The function object, which for operator test cases is a wrapper that allows
39+
# test logic to be generalised.
40+
# - The argument strategies, which can be used to draw arguments for the test
41+
# case. They may require additional filtering for certain test cases.
42+
# - right_is_scalar (binary parameters), which denotes if the right argument is
43+
# a scalar in a test case. This can be used to appropiately adjust draw
44+
# filtering and test logic.
45+
46+
3247
func_to_op = {v: k for k, v in dh.op_to_func.items()}
48+
all_op_to_symbol = {**dh.binary_op_to_symbol, **dh.inplace_op_to_symbol}
49+
finite_kw = {"allow_nan": False, "allow_infinity": False}
3350

3451
unary_argnames = ("func_name", "func", "strat")
3552
UnaryParam = Param[str, Callable[[Array], Array], st.SearchStrategy[Array]]
@@ -48,9 +65,6 @@ def make_unary_params(
4865
]
4966

5067

51-
all_op_to_symbol = {**dh.binary_op_to_symbol, **dh.inplace_op_to_symbol}
52-
finite_kw = {"allow_nan": False, "allow_infinity": False}
53-
5468
binary_argnames = (
5569
"func_name",
5670
"func",

0 commit comments

Comments
 (0)