Skip to content

assert(Not)AlmostEqual(s) specifies the type as float #7891

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
vnmabus opened this issue May 20, 2022 · 1 comment · Fixed by #8066
Closed

assert(Not)AlmostEqual(s) specifies the type as float #7891

vnmabus opened this issue May 20, 2022 · 1 comment · Fixed by #8066
Labels
stubs: false positive Type checkers report false errors

Comments

@vnmabus
Copy link

vnmabus commented May 20, 2022

assert(Not)AlmostEqual(s) specifies the type as float or datetime.datetime, when in practice it works also with other types that support subtraction, absolute value, rounding and comparison with zero, such as Fraction or Decimal.

This should be fixed (using TypeVar and a Protocol) to prevent Mypy errors in tests that use these types.

@srittau
Copy link
Collaborator

srittau commented May 20, 2022

Seems reasonable. Any PRs welcome!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
stubs: false positive Type checkers report false errors
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants