You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: test-data/unit/check-plugin-attrs.test
+6-5Lines changed: 6 additions & 5 deletions
Original file line number
Diff line number
Diff line change
@@ -1596,16 +1596,15 @@ def f(t: TA) -> None:
1596
1596
[builtins fixtures/plugin_attrs.pyi]
1597
1597
1598
1598
[case testNonattrsFields]
1599
-
# flags: --no-strict-optional
1600
1599
from typing import Any, cast, Type
1601
1600
from attrs import fields
1602
1601
1603
1602
class A:
1604
1603
b: int
1605
1604
c: str
1606
1605
1607
-
fields(A) # E: Argument 1 to "fields" has incompatible type "Type[A]"; expected an attrs class
1608
-
fields(None) # E: Argument 1 to "fields" has incompatible type "None"; expected an attrs class
1606
+
fields(A) # E: Argument 1 to "fields" has incompatible type "Type[A]"; expected "Type[AttrsInstance]"
1607
+
fields(None) # E: Argument 1 to "fields" has incompatible type "None"; expected "Type[AttrsInstance]"
1609
1608
fields(cast(Any, 42))
1610
1609
fields(cast(Type[Any], 43))
1611
1610
@@ -2167,7 +2166,8 @@ TA = TypeVar('TA', bound=A)
2167
2166
TB = TypeVar('TB', bound=B)
2168
2167
2169
2168
def f(b_or_t: TA | TB | int) -> None:
2170
-
a2 = attrs.evolve(b_or_t) # E: Argument 1 to "evolve" has type "Union[TA, TB, int]" whose item "TB" is not bound to an attrs class # E: Argument 1 to "evolve" has incompatible type "Union[TA, TB, int]" whose item "int" is not an attrs class
2169
+
a2 = attrs.evolve(b_or_t) # E: Argument 1 to "evolve" has type "Union[TA, TB, int]" whose item "TB" is not bound to an attrs class \
2170
+
# E: Argument 1 to "evolve" has incompatible type "Union[TA, TB, int]" whose item "int" is not an attrs class
2171
2171
2172
2172
2173
2173
[builtins fixtures/plugin_attrs.pyi]
@@ -2216,7 +2216,8 @@ def h(t: TNone) -> None:
2216
2216
_ = attrs.evolve(t, x=42) # E: Argument 1 to "evolve" has a variable type "TNone" not bound to an attrs class
2217
2217
2218
2218
def x(t: TUnion) -> None:
2219
-
_ = attrs.evolve(t, x=42) # E: Argument 1 to "evolve" has incompatible type "TUnion" whose item "str" is not an attrs class # E: Argument 1 to "evolve" has incompatible type "TUnion" whose item "int" is not an attrs class
2219
+
_ = attrs.evolve(t, x=42) # E: Argument 1 to "evolve" has incompatible type "TUnion" whose item "str" is not an attrs class \
2220
+
# E: Argument 1 to "evolve" has incompatible type "TUnion" whose item "int" is not an attrs class
0 commit comments