Skip to content

Commit

Permalink
Update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Tinche committed May 10, 2023
1 parent 7126c05 commit c95478d
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion mypy/plugins/attrs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1096,7 +1096,7 @@ def fields_function_sig_callback(ctx: mypy.plugin.FunctionSigContext) -> Callabl
)

ctx.api.fail(
f'Argument 1 to "fields" has incompatible type "{format_type_bare(proper_type)}"; expected an attrs class',
f'Argument 1 to "fields" has incompatible type "{format_type_bare(proper_type, ctx.api.options)}"; expected an attrs class',
ctx.context,
)
return ctx.default_signature
6 changes: 3 additions & 3 deletions test-data/unit/check-plugin-attrs.test
Original file line number Diff line number Diff line change
Expand Up @@ -1562,7 +1562,7 @@ reveal_type(f(A)[0]) # N: Revealed type is "attr.Attribute[builtins.int]"
reveal_type(f(A).b) # N: Revealed type is "attr.Attribute[builtins.int]"
f(A).x # E: "____main___A_AttrsAttributes__" has no attribute "x"

[builtins fixtures/attr.pyi]
[builtins fixtures/plugin_attrs.pyi]

[case testAttrsGenericFields]
from typing import TypeVar
Expand All @@ -1584,7 +1584,7 @@ def f(t: TA) -> None:
fields(t).x # E: "____main___A_AttrsAttributes__" has no attribute "x"


[builtins fixtures/attr.pyi]
[builtins fixtures/plugin_attrs.pyi]

[case testNonattrsFields]
from typing import Any, cast
Expand All @@ -1598,7 +1598,7 @@ fields(A) # E: Argument 1 to "fields" has incompatible type "Type[A]"; expected
fields(None) # E: Argument 1 to "fields" has incompatible type "None"; expected an attrs class
fields(cast(Any, 42))

[builtins fixtures/attr.pyi]
[builtins fixtures/plugin_attrs.pyi]

[case testAttrsInitMethodAlwaysGenerates]
from typing import Tuple
Expand Down

0 comments on commit c95478d

Please sign in to comment.