Skip to content
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

Bump pytest from 7.4.4 to 8.0.2 #51

Merged
merged 4 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from 3 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 requirements/requirements-test.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
coverage==7.4.3
pytest==7.4.4
pytest==8.0.2
pytest-cov==4.1.0
pytest-xdist==3.5.0
4 changes: 2 additions & 2 deletions synced_collections/numpy_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,11 @@ def _is_numpy_scalar(data):
def _is_complex(data):
"""Check if an object is complex.

This function works for both numpy raw Python data types.
This function works for numpy arrays, scalars, and raw Python data types.

Returns
-------
bool
Whether or not the input is a complex number.
"""
return (NUMPY and numpy.iscomplex(data).any()) or (isinstance(data, complex))
return (NUMPY and numpy.iscomplexobj(data)) or isinstance(data, complex)
vyasr marked this conversation as resolved.
Show resolved Hide resolved
20 changes: 5 additions & 15 deletions tests/synced_collection_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -531,9 +531,7 @@ def test_set_get_numpy_float_data(self, synced_collection, dtype, shape):
)

if has_corresponding_python_type:
with pytest.raises((ValueError, TypeError)), pytest.warns(
NumpyConversionWarning
):
with pytest.raises((ValueError, TypeError)):
vyasr marked this conversation as resolved.
Show resolved Hide resolved
synced_collection["numpy_dtype_val"] = value
else:
with pytest.warns(NumpyConversionWarning):
Expand All @@ -553,9 +551,7 @@ def test_set_get_numpy_complex_data(self, synced_collection, dtype, shape):
# not a priority to test here).
value = dtype(random_sample(shape))

with pytest.raises((ValueError, TypeError)), pytest.warns(
NumpyConversionWarning
):
with pytest.raises((ValueError, TypeError)):
synced_collection["numpy_dtype_val"] = value


Expand Down Expand Up @@ -814,9 +810,7 @@ def test_set_get_numpy_float_data(self, synced_collection, dtype, shape):
should_fail = isinstance(test_value, (numpy.number, numpy.bool_))

if should_fail:
with pytest.raises((ValueError, TypeError)), pytest.warns(
NumpyConversionWarning
):
with pytest.raises((ValueError, TypeError)):
synced_collection.append(value)
else:
with pytest.warns(NumpyConversionWarning):
Expand All @@ -840,14 +834,10 @@ def test_set_get_numpy_complex_data(self, synced_collection, dtype, shape):
# not a priority to test here).
value = dtype(random_sample(shape))

with pytest.raises((ValueError, TypeError)), pytest.warns(
NumpyConversionWarning
):
with pytest.raises((ValueError, TypeError)):
synced_collection.append(value)

with pytest.raises((ValueError, TypeError)), pytest.warns(
NumpyConversionWarning
):
with pytest.raises((ValueError, TypeError)):
synced_collection[-1] = value

@pytest.mark.parametrize("dtype", NUMPY_INT_TYPES)
Expand Down
Loading