Skip to content

Fix mypy warnings.#947

Merged
mdwelsh merged 6 commits into
mainfrom
matt/fix-mypy-warnings
Oct 18, 2024
Merged

Fix mypy warnings.#947
mdwelsh merged 6 commits into
mainfrom
matt/fix-mypy-warnings

Conversation

@mdwelsh
Copy link
Copy Markdown
Contributor

@mdwelsh mdwelsh commented Oct 18, 2024

This PR fixes issues in the code that were leading to a bunch of mypy warnings. We now get no output from mypy when running on this branch (which is good).

It also replaces the test that was using reveal_type with the equivalent (and simpler) assert_type.

@mdwelsh mdwelsh requested review from HenryL27 and bsowell October 18, 2024 00:11
assert 'Revealed type is "builtins.int"' in mypy_res[0]
def test_mypy_type() -> None:
res = require_fn()
assert_type(res, int)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

assert_type is only present in Python 3.11, so I would expect your unit tests to fail on 3.9 and 3.10.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Turns out this does work if we import from typing_extensions!

@mdwelsh mdwelsh requested a review from bsowell October 18, 2024 05:29
Copy link
Copy Markdown
Contributor

@bsowell bsowell left a comment

Choose a reason for hiding this comment

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

LGTM. Thanks.

@mdwelsh mdwelsh merged commit 6f76f20 into main Oct 18, 2024
@HenryL27 HenryL27 deleted the matt/fix-mypy-warnings branch August 30, 2025 00:03
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