scientific-python / pytest-doctestplus

Pytest plugin providing advanced doctest features
Other
94 stars 38 forks source link

Allow float comparison in dicts #186

Closed hamogu closed 2 years ago

hamogu commented 2 years ago

Before this PR, floating numbers in arrays are compared as floating numbers, but floating numbers in dicts are not, because they end on "}". This PR simply adds "}" to the regexp that determines what can be at the end of a floating number to allows for doctests like

        >>> x = {'a': 1/3., 'b': 2/3.}
        >>> x    # doctest: +FLOAT_CMP
        {'a': 0.333333, 'b': 0.666666}

which failed before this PR.

pllim commented 2 years ago

CI was disabled due to inactivity. I am closing/reopening to trigger proper CI.

hamogu commented 2 years ago

I have not been following this repro, so I don't know how much development is happening. On the one hand, it seems a lot to to a release for exactly one added character in the code base excluding tests and changelogs [*], on the other hand, in https://github.com/sherpa/sherpa/pull/1521#issuecomment-1255341074 I've already decided to "just let my dict-comparison fail until pytest-doctestplus has a new release".

*: But I'm happy to compete for ""Smallest change that got it's own release

pllim commented 2 years ago

No other PRs are open and I don't see anyone fixing other issues anytime soon...

pllim commented 2 years ago

@saimn , what do you think? Do we do a new release now?

saimn commented 2 years ago

I guess we can, it's supposed to be as simple as pushing a new tag :)

pllim commented 2 years ago

OK, I'll do it.

pllim commented 2 years ago

Okay, done! https://github.com/astropy/pytest-doctestplus/releases/tag/v0.12.1

saimn commented 2 years ago

Thanks !

bsipocz commented 2 years ago

More fixes and issues to come as we tests for upstream usability, but even then, doing incremental small releases is good.