@@ -60,12 +60,13 @@ so as to not unexpectedly fail the suite.
6060
6161### Primary tests
6262
63- Every function—including array object methods—has a respective test method. We
64- use [ Hypothesis] ( https://hypothesis.readthedocs.io/en/latest/ ) to generate a
65- diverse set of valid inputs. This means array inputs will cover different dtypes
66- and shapes, as well as contain interesting elements. These examples generate
67- with interesting arrangements of non-array positional arguments and keyword
68- arguments.
63+ Every function—including array object methods—has a respective test
64+ method<sup >1</sup >. We use
65+ [ Hypothesis] ( https://hypothesis.readthedocs.io/en/latest/ )
66+ to generate a diverse set of valid inputs. This means array inputs will cover
67+ different dtypes and shapes, as well as contain interesting elements. These
68+ examples generate with interesting arrangements of non-array positional
69+ arguments and keyword arguments.
6970
7071Each test case will cover the following areas if relevant:
7172
@@ -179,7 +180,7 @@ many utilities that parralel NumPy's own test utils in the `*_helpers.py` files.
179180
180181### Tools
181182
182- Hypothesis should always be used for the primary tests, and can be useful
183+ Hypothesis should almost always be used for the primary tests, and can be useful
183184elsewhere. Effort should be made so drawn arguments are labeled with their
184185respective names. For
185186[ ` st.data() ` ] ( https://hypothesis.readthedocs.io/en/latest/data.html#hypothesis.strategies.data ) ,
@@ -254,3 +255,23 @@ come across.
254255 for output values (particularly epsilons for floating-point outputs), so we
255256 need to review these and either implement assertions or properly note the lack
256257 thereof.
258+
259+ ---
260+
261+ <sup >1</sup >The only exceptions to having just one primary test per function are:
262+
263+ * [ ` asarray() ` ] ( https://data-apis.org/array-api/latest/API_specification/generated/signatures.creation_functions.asarray.html ) ,
264+ which is tested by ` test_asarray_scalars ` and ` test_asarray_arrays ` in
265+ ` test_creation_functions.py ` . Testing ` asarray() ` works with scalars (and
266+ nested sequences of scalars) is fundamental to testing that it works with
267+ arrays, as said arrays can only be generated by passing scalar sequences to
268+ ` asarray() ` .
269+
270+ * Indexing methods
271+ ([ ` __getitem__() ` ] ( https://data-apis.org/array-api/latest/API_specification/generated/signatures.array_object.array.__getitem__.html )
272+ and
273+ [ ` __setitem__() ` ] ( https://data-apis.org/array-api/latest/API_specification/generated/signatures.array_object.array.__setitem__.html ) ),
274+ which respectively have both a test for non-array indices and a test for
275+ boolean array indices. This is because [ masking is
276+ opt-in] ( https://data-apis.org/array-api/latest/API_specification/indexing.html#boolean-array-indexing )
277+ (and boolean arrays need to be generated by indexing arrays anyway).
0 commit comments