Skip to content

Commit b311c83

Browse files
committed
Merge branch 'master' into 2023-fixes
2 parents 4f0214e + d295a0a commit b311c83

File tree

3 files changed

+11
-10
lines changed

3 files changed

+11
-10
lines changed

array_api_tests/test_array_object.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,10 +243,11 @@ def test_setitem_masking(shape, data):
243243

244244

245245
def make_scalar_casting_param(
246-
method_name: str, dtype_name: DataType, stype: ScalarType
246+
method_name: str, dtype: DataType, stype: ScalarType
247247
) -> Param:
248+
dtype_name = dh.dtype_to_name[dtype]
248249
return pytest.param(
249-
method_name, dtype_name, stype, id=f"{method_name}({dtype_name})"
250+
method_name, dtype, stype, id=f"{method_name}({dtype_name})"
250251
)
251252

252253

array_api_tests/test_special_cases.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323
from warnings import warn
2424

2525
import pytest
26-
from hypothesis import given, note, settings
26+
from hypothesis import given, note, settings, assume
2727
from hypothesis import strategies as st
2828

2929
from array_api_tests.typing import Array, DataType
@@ -1333,10 +1333,11 @@ def test_empty_arrays(func_name, expected): # TODO: parse docstrings to get exp
13331333
)
13341334
def test_nan_propagation(func_name, x, data):
13351335
func = getattr(xp, func_name)
1336-
set_idx = data.draw(
1337-
xps.indices(x.shape, max_dims=0, allow_ellipsis=False), label="set idx"
1336+
nan_positions = data.draw(
1337+
hh.arrays(dtype=hh.bool_dtype, shape=x.shape), label="nan_positions"
13381338
)
1339-
x[set_idx] = float("nan")
1339+
assume(xp.any(nan_positions))
1340+
x = xp.where(nan_positions, xp.asarray(float("nan")), x)
13401341
note(f"{x=}")
13411342

13421343
out = func(x)

conftest.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from functools import lru_cache
22
from pathlib import Path
33
import argparse
4-
import math
54
import warnings
65
import os
76

@@ -37,7 +36,7 @@ def pytest_addoption(parser):
3736
"--hypothesis-max-examples",
3837
"--max-examples",
3938
action="store",
40-
default=20,
39+
default=100,
4140
type=int,
4241
help="set the Hypothesis max_examples setting",
4342
)
@@ -162,7 +161,7 @@ def pytest_collection_modifyitems(config, items):
162161

163162
disabled_exts = config.getoption("--disable-extension")
164163
disabled_dds = config.getoption("--disable-data-dependent-shapes")
165-
unvectorized_max_examples = math.ceil(math.log(config.getoption("--hypothesis-max-examples")))
164+
unvectorized_max_examples = config.getoption("--hypothesis-max-examples")//10
166165

167166
# 2. Iterate through items and apply markers accordingly
168167
# ------------------------------------------------------
@@ -226,7 +225,7 @@ def pytest_collection_modifyitems(config, items):
226225
# ----------------------------------
227226

228227
bad_ids_end_msg = (
229-
"Note the relevant tests might not of been collected by pytest, or "
228+
"Note the relevant tests might not have been collected by pytest, or "
230229
"another specified id might have already matched a test."
231230
)
232231
bad_skip_ids = [id_ for id_, matched in skip_id_matched.items() if not matched]

0 commit comments

Comments
 (0)