Source: python-hypothesis
Version: 6.64.0-1
Severity: serious
User: debian...@lists.debian.org
Usertags: regression

Hi Maintainer

Recently, the autopkgtests of python-hypothesis regressed in testing
[1].  I've copied what I hope is the relevant part of the log below.

Regards
Graham


[1] https://ci.debian.net/packages/p/python-hypothesis/testing/amd64/


=================================== FAILURES ===================================
_______________ test_overflowing_integers_are_deprecated[False] ________________

fill = False

>   ???

tests/numpy/test_gen_data.py:347:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/common/utils.py:102: in inverted_test
    f(*arguments, **kwargs)
tests/numpy/test_gen_data.py:347: in test_overflowing_integers_are_deprecated
    ???
tests/numpy/test_gen_data.py:354: in test_overflowing_integers_are_deprecated
    arr = data.draw(nps.arrays(dtype="int8", shape=(1,), **kw))
/usr/lib/python3/dist-packages/hypothesis/strategies/_internal/core.py:1836:
in draw
    result = self.conjecture_data.draw(strategy)
/usr/lib/python3/dist-packages/hypothesis/internal/conjecture/data.py:946:
in draw
    return strategy.do_draw(self)
/usr/lib/python3/dist-packages/hypothesis/strategies/_internal/lazy.py:156:
in do_draw
    return data.draw(self.wrapped_strategy)
/usr/lib/python3/dist-packages/hypothesis/internal/conjecture/data.py:941:
in draw
    return strategy.do_draw(self)
/usr/lib/python3/dist-packages/hypothesis/extra/numpy.py:324: in do_draw
    self.set_element(data.draw(self.fill), one_element, 0, fill=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <hypothesis.extra.numpy.ArrayStrategy object at 0x7f3c03eefdc0>
val = 300, result = array([44], dtype=int8), idx = 0

    def set_element(self, val, result, idx, *, fill=False):
        try:
            result[idx] = val
        except TypeError as err:
            raise InvalidArgument(
                f"Could not add element={val!r} of {val.dtype!r} to array of "
                f"{result.dtype!r} - possible mismatch of time units in dtypes?"
            ) from err
        try:
            elem_changed = self._check_elements and val != result[idx]
and val == val
        except Exception as err:  # pragma: no cover
            # This branch only exists to help debug weird behaviour in Numpy,
            # such as the string problems we had a while back.
            raise HypothesisException(
                "Internal error when checking element=%r of %r to array of %r"
                % (val, val.dtype, result.dtype)
            ) from err
        if elem_changed:
            strategy = self.fill if fill else self.element_strategy
            if self.dtype.kind == "f":  # pragma: no cover
                # This logic doesn't trigger in our coverage tests
under Numpy 1.24+,
                # with built-in checks for overflow, but we keep it
for good error
                # messages and compatibility with older versions of Numpy.
                try:
                    is_subnormal = 0 < abs(val) < np.finfo(self.dtype).tiny
                except Exception:
                    # val may be a non-float that does not support the
                    # operations __lt__ and __abs__
                    is_subnormal = False
                if is_subnormal:
                    raise InvalidArgument(
                        f"Generated subnormal float {val} from strategy "
                        f"{strategy} resulted in {result[idx]!r}, probably "
                        "as a result of NumPy being built with flush-to-zero "
                        "compiler options. Consider passing "
                        "allow_subnormal=False."
                    )
>           raise InvalidArgument(
                "Generated array element %r from %r cannot be represented as "
                "dtype %r - instead it becomes %r (type %r).  Consider
using a more "
                "precise strategy, for example passing the `width` argument to "
                "`floats()`."
                % (val, strategy, self.dtype, result[idx], type(result[idx]))
            )
E           hypothesis.errors.InvalidArgument: Generated array element
300 from just(300) cannot be represented as dtype dtype('int8') -
instead it becomes 44 (type <class 'numpy.int8'>).  Consider using a
more precise strategy, for example passing the `width` argument to
`floats()`.
E           Falsifying example: test_overflowing_integers_are_deprecated(
E               data=data(...),
E               fill=False,
E           )

/usr/lib/python3/dist-packages/hypothesis/extra/numpy.py:229: InvalidArgument
________________ test_overflowing_integers_are_deprecated[True] ________________

fill = True

>   ???

tests/numpy/test_gen_data.py:347:
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
tests/common/utils.py:102: in inverted_test
    f(*arguments, **kwargs)
tests/numpy/test_gen_data.py:347: in test_overflowing_integers_are_deprecated
    ???
tests/numpy/test_gen_data.py:354: in test_overflowing_integers_are_deprecated
    arr = data.draw(nps.arrays(dtype="int8", shape=(1,), **kw))
/usr/lib/python3/dist-packages/hypothesis/strategies/_internal/core.py:1836:
in draw
    result = self.conjecture_data.draw(strategy)
/usr/lib/python3/dist-packages/hypothesis/internal/conjecture/data.py:946:
in draw
    return strategy.do_draw(self)
/usr/lib/python3/dist-packages/hypothesis/strategies/_internal/lazy.py:156:
in do_draw
    return data.draw(self.wrapped_strategy)
/usr/lib/python3/dist-packages/hypothesis/internal/conjecture/data.py:941:
in draw
    return strategy.do_draw(self)
/usr/lib/python3/dist-packages/hypothesis/extra/numpy.py:324: in do_draw
    self.set_element(data.draw(self.fill), one_element, 0, fill=True)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <hypothesis.extra.numpy.ArrayStrategy object at 0x7f3c083d0d30>
val = 300, result = array([44], dtype=int8), idx = 0

    def set_element(self, val, result, idx, *, fill=False):
        try:
            result[idx] = val
        except TypeError as err:
            raise InvalidArgument(
                f"Could not add element={val!r} of {val.dtype!r} to array of "
                f"{result.dtype!r} - possible mismatch of time units in dtypes?"
            ) from err
        try:
            elem_changed = self._check_elements and val != result[idx]
and val == val
        except Exception as err:  # pragma: no cover
            # This branch only exists to help debug weird behaviour in Numpy,
            # such as the string problems we had a while back.
            raise HypothesisException(
                "Internal error when checking element=%r of %r to array of %r"
                % (val, val.dtype, result.dtype)
            ) from err
        if elem_changed:
            strategy = self.fill if fill else self.element_strategy
            if self.dtype.kind == "f":  # pragma: no cover
                # This logic doesn't trigger in our coverage tests
under Numpy 1.24+,
                # with built-in checks for overflow, but we keep it
for good error
                # messages and compatibility with older versions of Numpy.
                try:
                    is_subnormal = 0 < abs(val) < np.finfo(self.dtype).tiny
                except Exception:
                    # val may be a non-float that does not support the
                    # operations __lt__ and __abs__
                    is_subnormal = False
                if is_subnormal:
                    raise InvalidArgument(
                        f"Generated subnormal float {val} from strategy "
                        f"{strategy} resulted in {result[idx]!r}, probably "
                        "as a result of NumPy being built with flush-to-zero "
                        "compiler options. Consider passing "
                        "allow_subnormal=False."
                    )
>           raise InvalidArgument(
                "Generated array element %r from %r cannot be represented as "
                "dtype %r - instead it becomes %r (type %r).  Consider
using a more "
                "precise strategy, for example passing the `width` argument to "
                "`floats()`."
                % (val, strategy, self.dtype, result[idx], type(result[idx]))
            )
E           hypothesis.errors.InvalidArgument: Generated array element
300 from just(300) cannot be represented as dtype dtype('int8') -
instead it becomes 44 (type <class 'numpy.int8'>).  Consider using a
more precise strategy, for example passing the `width` argument to
`floats()`.
E           Falsifying example: test_overflowing_integers_are_deprecated(
E               data=data(...),
E               fill=True,
E           )

/usr/lib/python3/dist-packages/hypothesis/extra/numpy.py:229: InvalidArgument

Reply via email to