Skip to content

Test utilities #28

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 5 commits into from
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
3 changes: 2 additions & 1 deletion tests/test_constants.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ def test_constant_dtype(dtype_index: int) -> None:
)
def test_constant_complex_dtype(dtype_index: int) -> None:
"""Test if constant_complex creates an array with the correct dtype."""
if dtype_index not in [1, 3] or (dtype_index == 3 and not wrapper.get_dbl_support()):
if not
pytest.skip()

dtype = dtypes.c_api_value_to_dtype(dtype_index)
Expand Down Expand Up @@ -219,3 +219,4 @@ def test_constant_ulong_dtype() -> None:
assert dtypes.c_api_value_to_dtype(wrapper.get_type(result)) == dtype
else:
pytest.skip()

13 changes: 13 additions & 0 deletions tests/test_utilities.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pytest

import arrayfire_wrapper.lib as wrapper
from arrayfire_wrapper.dtypes import Dtype, c64, f16, f64


def check_type_supported(dtype: Dtype) -> None:
"""Checks to see if the specified type is supported by the current system"""
if dtype in [f64, c64] and not wrapper.get_dbl_support():
pytest.skip("Device does not support double types")

if dtype == f16 and not wrapper.get_half_support():
pytest.skip("Device does not support half types.")
Loading