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
Under doctest.ELLIPSIS this means that ... matches any string --- essentially this defines the tolerance for this particular example.
We do have doctest.ELLIPSIS on by default, and it works fine --- but it curiously breaks down under numpy 2.0 scalar representation:
>>> import numpy as np
>>> np.sqrt(2)
np.float64(1.4142135623730951)
Normally, 1.4142 would evaluate to np.allclose to np.float64(1.4142135) --- but the ellipsis breaks it because the vanilla doctest does not understand np.float64 and our machinery does not understand ....
The solution is to probably
detect the trailing ellipsis in want, i.e. if want.edswith('...')
chop it off
adjust the atol, rtol to the number of sig figs (DTChecker._do_check should get explicit atol, rtol arguments defaulting to self.atol, self.rtol).
The text was updated successfully, but these errors were encountered:
Consider the following doctest example
Under
doctest.ELLIPSIS
this means that...
matches any string --- essentially this defines the tolerance for this particular example.We do have
doctest.ELLIPSIS
on by default, and it works fine --- but it curiously breaks down under numpy 2.0 scalar representation:Normally,
1.4142
would evaluate tonp.allclose
tonp.float64(1.4142135)
--- but the ellipsis breaks it because the vanilla doctest does not understandnp.float64
and our machinery does not understand...
.The solution is to probably
want
, i.e.if want.edswith('...')
atol, rtol
to the number of sig figs (DTChecker._do_check
should get explicitatol, rtol
arguments defaulting toself.atol, self.rtol
).The text was updated successfully, but these errors were encountered: