Open
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, rtol
to the number of sig figs (DTChecker._do_check
should get explicitatol, rtol
arguments defaulting toself.atol, self.rtol
).