Skip to content

Commit

Permalink
Fix failing test in Mypy 1.6.0 (#296):
Browse files Browse the repository at this point in the history
Since Mypy 1.6.0 changed how tuple types are printed, the check that depended
on the old behavior broke. The current method I am using is already a
workaround because I cant get Mypy's built-in type system working with Refurb,
though perhaps I should give it another try soon.

Closes #295
  • Loading branch information
dosisod authored Oct 17, 2023
1 parent 8d77d44 commit 1fa1d53
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion dev-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ fastapi==0.100.0
iniconfig==2.0.0
isort==5.12.0
mypy-extensions==1.0.0
mypy==1.5.1
mypy==1.6.0
packaging==23.1
pathspec==0.11.2
platformdirs==3.11.0
Expand Down
4 changes: 3 additions & 1 deletion refurb/checks/readability/no_or_default.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,9 @@ def check(node: OpExpr, errors: list[Error]) -> None:
return

type_name = (
"builtins.tuple" if str(ty).lower() == "tuple[]" else str(ty)
"builtins.tuple"
if str(ty).lower().startswith("tuple[")
else str(ty)
)

# Must check fullname for compatibility with older Mypy versions
Expand Down

0 comments on commit 1fa1d53

Please sign in to comment.