Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion array-api
Submodule array-api updated 211 files
5 changes: 3 additions & 2 deletions array_api_tests/dtype_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@ def result_type(*dtypes: DataType):
"boolean": (xp.bool,),
"integer": all_int_dtypes,
"floating-point": real_float_dtypes,
"real-valued": real_float_dtypes,
"real-valued floating-point": real_float_dtypes,
"complex floating-point": complex_dtypes,
"numeric": numeric_dtypes,
"integer or boolean": bool_and_all_int_dtypes,
}
Expand All @@ -364,8 +367,6 @@ def result_type(*dtypes: DataType):
dtype_category = "floating-point"
dtypes = category_to_dtypes[dtype_category]
func_in_dtypes[name] = dtypes
# See https://github.com/data-apis/array-api/pull/413
func_in_dtypes["expm1"] = real_float_dtypes


func_returns_bool = {
Expand Down
14 changes: 8 additions & 6 deletions array_api_tests/stubs.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,22 @@
"extension_to_funcs",
]

spec_version = "2022.12"
spec_module = "_" + spec_version.replace('.', '_')

spec_dir = Path(__file__).parent.parent / "array-api" / "spec" / "API_specification"
spec_dir = Path(__file__).parent.parent / "array-api" / "spec" / spec_version / "API_specification"
assert spec_dir.exists(), f"{spec_dir} not found - try `git submodule update --init`"
sigs_dir = spec_dir / "signatures"
sigs_dir = Path(__file__).parent.parent / "array-api" / "src" / "array_api_stubs" / spec_module
assert sigs_dir.exists()

spec_abs_path: str = str(spec_dir.resolve())
sys.path.append(spec_abs_path)
assert find_spec("signatures") is not None
sigs_abs_path: str = str(sigs_dir.parent.parent.resolve())
sys.path.append(sigs_abs_path)
assert find_spec(f"array_api_stubs.{spec_module}") is not None

name_to_mod: Dict[str, ModuleType] = {}
for path in sigs_dir.glob("*.py"):
name = path.name.replace(".py", "")
name_to_mod[name] = import_module(f"signatures.{name}")
name_to_mod[name] = import_module(f"array_api_stubs.{spec_module}.{name}")

array = name_to_mod["array_object"].array
array_methods = [
Expand Down
4 changes: 4 additions & 0 deletions array_api_tests/test_special_cases.py
Original file line number Diff line number Diff line change
Expand Up @@ -1197,6 +1197,10 @@ def parse_binary_case_block(case_block: str) -> List[BinaryCase]:
# its False - Hypothesis will complain if we reject too many examples, thus
# indicating we've done something wrong.

assert len(unary_params) != 0 # sanity check
assert len(binary_params) != 0 # sanity check
assert len(iop_params) != 0 # sanity check


@pytest.mark.parametrize("func_name, func, case", unary_params)
@given(
Expand Down