-
-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
enhancementNew features w.r.t. the original refguide-checkNew features w.r.t. the original refguide-checkhelp wantedExtra attention is neededExtra attention is needed
Description
Consider the following doctest example
>>> np.sqrt(2)
1.4...
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, rtolto the number of sig figs (DTChecker._do_checkshould get explicitatol, rtolarguments defaulting toself.atol, self.rtol).
Metadata
Metadata
Assignees
Labels
enhancementNew features w.r.t. the original refguide-checkNew features w.r.t. the original refguide-checkhelp wantedExtra attention is neededExtra attention is needed