You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
FAILED tests/test_stateful_repo_ops.py::VersionControlTest::runTest - RuntimeWarning: invalid value encountered in multiply
____________________________________________________________________________________________ VersionControlTest.runTest _____________________________________________________________________________________________
self = <hypothesis.stateful.VersionControlStateMachine.TestCase testMethod=runTest>
def runTest(self):
> run_state_machine_as_test(cls, settings=self.settings)
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/stateful.py:437:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/stateful.py:241: in run_state_machine_as_test
run_state_machine(state_machine_factory)
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/stateful.py:108: in run_state_machine
@given(st.data())
tests/test_stateful_repo_ops.py:224: in initialize
self.set_doc(path="zarr.json", value=data.draw(v3_array_metadata()))
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/strategies/_internal/core.py:2151: in draw
result = self.conjecture_data.draw(strategy, observe_as=f"generate:{desc}")
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/internal/conjecture/data.py:2503: in draw
return strategy.do_draw(self)
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/strategies/_internal/lazy.py:167: in do_draw
return data.draw(self.wrapped_strategy)
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/internal/conjecture/data.py:2503: in draw
return strategy.do_draw(self)
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/hypothesis/strategies/_internal/core.py:1775: in do_draw
return self.definition(data.draw, *self.args, **self.kwargs)
tests/test_stateful_repo_ops.py:74: in v3_array_metadata
metadata = ArrayV3Metadata(
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/zarr/core/metadata/v3.py:274: in __init__
fill_value_parsed = parse_fill_value(
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/zarr/core/metadata/v3.py:573: in parse_fill_value
and np.isclose(np.imag(fill_value), np.imag(casted_value), equal_nan=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
a = nan, b = nan, rtol = 1e-05, atol = 1e-08, equal_nan = True
@array_function_dispatch(_isclose_dispatcher)
def isclose(a, b, rtol=1.e-5, atol=1.e-8, equal_nan=False):
"""
Returns a boolean array where two arrays are element-wise equal within a
tolerance.
The tolerance values are positive, typically very small numbers. The
relative difference (`rtol` * abs(`b`)) and the absolute difference
`atol` are added together to compare against the absolute difference
between `a` and `b`.
.. warning:: The default `atol` is not appropriate for comparing numbers
that are much smaller than one (see Notes).
Parameters
----------
a, b : array_like
Input arrays to compare.
rtol : float
The relative tolerance parameter (see Notes).
atol : float
The absolute tolerance parameter (see Notes).
equal_nan : bool
Whether to compare NaN's as equal. If True, NaN's in `a` will be
considered equal to NaN's in `b` in the output array.
Returns
-------
y : array_like
Returns a boolean array of where `a` and `b` are equal within the
given tolerance. If both `a` and `b` are scalars, returns a single
boolean value.
See Also
--------
allclose
math.isclose
Notes
-----
.. versionadded:: 1.7.0
For finite values, isclose uses the following equation to test whether
two floating point values are equivalent.
absolute(`a` - `b`) <= (`atol` + `rtol` * absolute(`b`))
Unlike the built-in `math.isclose`, the above equation is not symmetric
in `a` and `b` -- it assumes `b` is the reference value -- so that
`isclose(a, b)` might be different from `isclose(b, a)`. Furthermore,
the default value of atol is not zero, and is used to determine what
small values should be considered close to zero. The default value is
appropriate for expected values of order unity: if the expected values
are significantly smaller than one, it can result in false positives.
`atol` should be carefully selected for the use case at hand. A zero value
for `atol` will result in `False` if either `a` or `b` is zero.
`isclose` is not defined for non-numeric data types.
`bool` is considered a numeric data-type for this purpose.
Examples
--------
>>> np.isclose([1e10,1e-7], [1.00001e10,1e-8])
array([ True, False])
>>> np.isclose([1e10,1e-8], [1.00001e10,1e-9])
array([ True, True])
>>> np.isclose([1e10,1e-8], [1.0001e10,1e-9])
array([False, True])
>>> np.isclose([1.0, np.nan], [1.0, np.nan])
array([ True, False])
>>> np.isclose([1.0, np.nan], [1.0, np.nan], equal_nan=True)
array([ True, True])
>>> np.isclose([1e-8, 1e-7], [0.0, 0.0])
array([ True, False])
>>> np.isclose([1e-100, 1e-7], [0.0, 0.0], atol=0.0)
array([False, False])
>>> np.isclose([1e-10, 1e-10], [1e-20, 0.0])
array([ True, True])
>>> np.isclose([1e-10, 1e-10], [1e-20, 0.999999e-10], atol=0.0)
array([False, True])
"""
def within_tol(x, y, atol, rtol):
with errstate(invalid='ignore'), _no_nep50_warning():
return less_equal(abs(x-y), atol + rtol * abs(y))
x = asanyarray(a)
y = asanyarray(b)
# Make sure y is an inexact type to avoid bad behavior on abs(MIN_INT).
# This will cause casting of x later. Also, make sure to allow subclasses
# (e.g., for numpy.ma).
# NOTE: We explicitly allow timedelta, which used to work. This could
# possibly be deprecated. See also gh-18286.
# timedelta works if `atol` is an integer or also a timedelta.
# Although, the default tolerances are unlikely to be useful
if y.dtype.kind != "m":
dt = multiarray.result_type(y, 1.)
y = asanyarray(y, dtype=dt)
xfin = isfinite(x)
yfin = isfinite(y)
if all(xfin) and all(yfin):
return within_tol(x, y, atol, rtol)
else:
finite = xfin & yfin
cond = zeros_like(finite, subok=True)
# Because we're using boolean indexing, x & y must be the same shape.
# Ideally, we'd just do x, y = broadcast_arrays(x, y). It's in
# lib.stride_tricks, though, so we can't import it here.
> x = x * ones_like(cond)
E RuntimeWarning: invalid value encountered in multiply
E Falsifying example:
E ----------
E state = VersionControlStateMachine()
E state.initialize(data=data(...))
E state.teardown()
../../miniconda3/envs/icechunk/lib/python3.12/site-packages/numpy/core/numeric.py:2358: RuntimeWarning
The text was updated successfully, but these errors were encountered:
FAILED tests/test_stateful_repo_ops.py::VersionControlTest::runTest - RuntimeWarning: invalid value encountered in multiply
The text was updated successfully, but these errors were encountered: