Skip to content

Commit

Permalink
Fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed Oct 16, 2023
1 parent 0eabb3a commit 9cc8124
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 14 deletions.
22 changes: 12 additions & 10 deletions tests/test_mypy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,7 @@
return 'hello'
- case: testAttrsUsingBadConverter
regex: true
main: |
import attr
from typing import overload
Expand All @@ -785,13 +786,14 @@
bad_overloaded: int = attr.ib(converter=bad_overloaded_converter)
reveal_type(A)
out: |
main:15: error: Cannot determine __init__ type from converter [misc]
main:15: error: Argument "converter" has incompatible type "Callable[[], str]"; expected "Callable[[Any], Any] | None" [arg-type]
main:16: error: Cannot determine __init__ type from converter [misc]
main:16: error: Argument "converter" has incompatible type overloaded function; expected "Callable[[Any], Any] | None" [arg-type]
main:17: note: Revealed type is "def (bad: Any, bad_overloaded: Any) -> main.A"
main:15: error: Cannot determine __init__ type from converter \[misc\]
main:15: error: Argument "converter" has incompatible type \"Callable\[\[\], str\]\"; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\]
main:16: error: Cannot determine __init__ type from converter \[misc\]
main:16: error: Argument "converter" has incompatible type overloaded function; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\]
main:17: note: Revealed type is "def (bad: Any, bad_overloaded: Any\) -> main.A"
- case: testAttrsUsingBadConverterReprocess
regex: true
main: |
import attr
from typing import overload
Expand All @@ -812,11 +814,11 @@
bad_overloaded: int = attr.ib(converter=bad_overloaded_converter)
reveal_type(A)
out: |
main:16: error: Cannot determine __init__ type from converter [misc]
main:16: error: Argument "converter" has incompatible type "Callable[[], str]"; expected "Callable[[Any], Any] | None" [arg-type]
main:17: error: Cannot determine __init__ type from converter [misc]
main:17: error: Argument "converter" has incompatible type overloaded function; expected "Callable[[Any], Any] | None" [arg-type]
main:18: note: Revealed type is "def (bad: Any, bad_overloaded: Any) -> main.A"
main:16: error: Cannot determine __init__ type from converter \[misc\]
main:16: error: Argument \"converter\" has incompatible type \"Callable\[\[\], str\]\"; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\]
main:17: error: Cannot determine __init__ type from converter \[misc\]
main:17: error: Argument "converter" has incompatible type overloaded function; expected (\"Callable\[\[Any\], Any\] \| None\"|\"Optional\[Callable\[\[Any\], Any\]\]\") \[arg-type\]
main:18: note: Revealed type is "def (bad: Any, bad_overloaded: Any\) -> main.A"
- case: testAttrsUsingUnsupportedConverter
main: |
Expand Down
5 changes: 1 addition & 4 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,11 @@ pass_env =
NO_COLOR
extras =
tests: tests
deps =
mypy: attrs[tests-mypy]
mypy: tests-mypy
commands =
tests: pytest {posargs:-n auto}
mypy: mypy tests/typing_example.py
mypy: mypy src/attrs/__init__.pyi src/attr/__init__.pyi src/attr/_typing_compat.pyi src/attr/_version_info.pyi src/attr/converters.pyi src/attr/exceptions.pyi src/attr/filters.pyi src/attr/setters.pyi src/attr/validators.pyi
allowlist_externals =
mypy

[testenv:py3{7,10,11}-tests]
extras = cov
Expand Down

0 comments on commit 9cc8124

Please sign in to comment.