-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Complete type hints of tests/unit/ directory #10435
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not read all the type hint additions in the test suite, but assume they are fine since Mypy is passing. The type hint changes in pip proper are all correct.
If you'd like me to break this down to multiple PRs to assist review, please let me know. I can either chunk it to fewer file changes at a time or if you notice standalone changes I can tease those out. If that is desirable, please let me know, it is no problem. |
tests/unit/test_base_command.py
Outdated
""" | ||
Call command.main(), and return the command's stderr. | ||
""" | ||
|
||
def raise_broken_stdout(): | ||
def raise_broken_stdout() -> int: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def raise_broken_stdout() -> int: | |
def raise_broken_stdout() -> NoReturn: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm at 44/64, and this looks pretty good! :)
tests/unit/test_cache.py
Outdated
entry = wc.get_cache_entry(persi_link, "persi", supported_tags) | ||
assert entry is not None | ||
assert entry.persistent | ||
entry = wc.get_cache_entry(ephem_link, "ephem", supported_tags) | ||
assert entry is not None | ||
assert not entry.persistent | ||
assert wc.get_cache_entry(other_link, "other", supported_tags) is None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
entry = wc.get_cache_entry(persi_link, "persi", supported_tags) | |
assert entry is not None | |
assert entry.persistent | |
entry = wc.get_cache_entry(ephem_link, "ephem", supported_tags) | |
assert entry is not None | |
assert not entry.persistent | |
assert wc.get_cache_entry(other_link, "other", supported_tags) is None | |
entry = wc.get_cache_entry(persi_link, "persi", supported_tags) | |
assert entry is not None | |
assert entry.persistent | |
entry = wc.get_cache_entry(ephem_link, "ephem", supported_tags) | |
assert entry is not None | |
assert not entry.persistent | |
assert wc.get_cache_entry(other_link, "other", supported_tags) is None |
I like whitespace.
tests/unit/test_req.py
Outdated
metadata = email.message.Message() | ||
metadata["name"] = "simplewheel" | ||
metadata["version"] = "1.0" | ||
req._metadata = metadata | ||
req.assert_source_matches_version() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
metadata = email.message.Message() | |
metadata["name"] = "simplewheel" | |
metadata["version"] = "1.0" | |
req._metadata = metadata | |
req.assert_source_matches_version() | |
metadata = email.message.Message() | |
metadata["name"] = "simplewheel" | |
metadata["version"] = "1.0" | |
req._metadata = metadata | |
req.assert_source_matches_version() |
As I was saying, I like my whitespace.
Thanks for the review. I applied all suggestions in the latest revision. |
FWIW, for large PRs like this, I'd encourage you to make |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alrighty. GitHub says I've looked at each file and marked it as viewed. :)
Adding these types exposed some tests that were passing invalid values
to functions.
These types also allowed refining some existing APIs.