Skip to content

Fix typings for unittest.TestCase.assertLessEqual#10798

Merged
srittau merged 1 commit into
python:mainfrom
ImogenBits:fix_unittest
Sep 28, 2023
Merged

Fix typings for unittest.TestCase.assertLessEqual#10798
srittau merged 1 commit into
python:mainfrom
ImogenBits:fix_unittest

Conversation

@ImogenBits

Copy link
Copy Markdown
Contributor

Currently unittest.TestCase.assertLessEqual uses SupportsDunderLT and SupportsDunderGT to bound its arguments, when it should be using SupportsDunderLE and SupportsDunderGE since it's using <= in its implementation, not <. This leads to false positives when making tests for classes that only implement the lax comparisons and not the strict ones.

This PR just fixes these two bounds to use the correct protocols.

@github-actions

Copy link
Copy Markdown
Contributor

According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉

@srittau srittau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@srittau
srittau merged commit b76b2af into python:main Sep 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants