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
- the library is named "attrs", not "attr"[^1]
- "attrs" could mean a test of Python attributes, so adding "plugin"
[^1]: at some point we'd also need to change tests to use `attrs.define`
and `attrs.fields` in all but tests meant to exercise the "old API"
takes_attrs_cls(A(1, "")) # E: Argument 1 to "takes_attrs_cls" has incompatible type "A"; expected "Type[AttrsInstance]"
1548
1548
takes_attrs_instance(A) # E: Argument 1 to "takes_attrs_instance" has incompatible type "Type[A]"; expected "AttrsInstance" # N: ClassVar protocol member AttrsInstance.__attrs_attrs__ can never be matched by a class object
1549
-
[builtins fixtures/attr.pyi]
1549
+
[builtins fixtures/plugin_attrs.pyi]
1550
1550
1551
1551
[case testAttrsInitMethodAlwaysGenerates]
1552
1552
from typing import Tuple
@@ -1564,7 +1564,7 @@ reveal_type(A) # N: Revealed type is "def (bc: Tuple[builtins.int, builtins.str
1564
1564
reveal_type(A.__init__) # N: Revealed type is "def (self: __main__.A, bc: Tuple[builtins.int, builtins.str])"
1565
1565
reveal_type(A.__attrs_init__) # N: Revealed type is "def (self: __main__.A, b: builtins.int, c: builtins.str)"
1566
1566
1567
-
[builtins fixtures/attr.pyi]
1567
+
[builtins fixtures/plugin_attrs.pyi]
1568
1568
1569
1569
[case testAttrsClassWithSlots]
1570
1570
import attr
@@ -1594,7 +1594,7 @@ class C:
1594
1594
def __attrs_post_init__(self) -> None:
1595
1595
self.b = 1 # E: Trying to assign name "b" that is not in "__slots__" of type "__main__.C"
1596
1596
self.c = 2 # E: Trying to assign name "c" that is not in "__slots__" of type "__main__.C"
1597
-
[builtins fixtures/attr.pyi]
1597
+
[builtins fixtures/plugin_attrs.pyi]
1598
1598
1599
1599
[case testAttrsWithMatchArgs]
1600
1600
# flags: --python-version 3.10
@@ -1610,7 +1610,7 @@ class ToMatch:
1610
1610
1611
1611
reveal_type(ToMatch(x=1, y=2, z=3).__match_args__) # N: Revealed type is "Tuple[Literal['x']?, Literal['y']?]"
1612
1612
reveal_type(ToMatch(1, 2, z=3).__match_args__) # N: Revealed type is "Tuple[Literal['x']?, Literal['y']?]"
1613
-
[builtins fixtures/attr.pyi]
1613
+
[builtins fixtures/plugin_attrs.pyi]
1614
1614
1615
1615
[case testAttrsWithMatchArgsDefaultCase]
1616
1616
# flags: --python-version 3.10
@@ -1631,7 +1631,7 @@ class ToMatch2:
1631
1631
1632
1632
t2: ToMatch2
1633
1633
reveal_type(t2.__match_args__) # N: Revealed type is "Tuple[Literal['x']?, Literal['y']?]"
1634
-
[builtins fixtures/attr.pyi]
1634
+
[builtins fixtures/plugin_attrs.pyi]
1635
1635
1636
1636
[case testAttrsWithMatchArgsOverrideExisting]
1637
1637
# flags: --python-version 3.10
@@ -1654,7 +1654,7 @@ class WithoutMatch:
1654
1654
y: int
1655
1655
1656
1656
reveal_type(WithoutMatch(x=1, y=2).__match_args__) # N: Revealed type is "Tuple[Literal['a']?, Literal['b']?]"
1657
-
[builtins fixtures/attr.pyi]
1657
+
[builtins fixtures/plugin_attrs.pyi]
1658
1658
1659
1659
[case testAttrsWithMatchArgsOldVersion]
1660
1660
# flags: --python-version 3.9
@@ -1668,7 +1668,7 @@ n: NoMatchArgs
1668
1668
1669
1669
reveal_type(n.__match_args__) # E: "NoMatchArgs" has no attribute "__match_args__" \
1670
1670
# N: Revealed type is "Any"
1671
-
[builtins fixtures/attr.pyi]
1671
+
[builtins fixtures/plugin_attrs.pyi]
1672
1672
1673
1673
[case testAttrsMultipleInheritance]
1674
1674
# flags: --python-version 3.10
@@ -1684,7 +1684,7 @@ class B:
1684
1684
1685
1685
class AB(A, B):
1686
1686
pass
1687
-
[builtins fixtures/attr.pyi]
1687
+
[builtins fixtures/plugin_attrs.pyi]
1688
1688
1689
1689
[case testAttrsForwardReferenceInTypeVarBound]
1690
1690
from typing import TypeVar, Generic
@@ -1698,7 +1698,7 @@ class D(Generic[T]):
1698
1698
1699
1699
class C:
1700
1700
pass
1701
-
[builtins fixtures/attr.pyi]
1701
+
[builtins fixtures/plugin_attrs.pyi]
1702
1702
1703
1703
[case testComplexTypeInAttrIb]
1704
1704
import a
@@ -1953,7 +1953,7 @@ def f() -> C:
1953
1953
1954
1954
c = attr.evolve(f(), name='foo')
1955
1955
1956
-
[builtins fixtures/attr.pyi]
1956
+
[builtins fixtures/plugin_attrs.pyi]
1957
1957
1958
1958
[case testEvolveFromNonAttrs]
1959
1959
import attr
@@ -1988,7 +1988,7 @@ reveal_type(a2) # N: Revealed type is "__main__.A[builtins.int]"
1988
1988
a2 = attrs.evolve(a, x='42') # E: Argument "x" to "evolve" of "A[int]" has incompatible type "str"; expected "int"
1989
1989
reveal_type(a2) # N: Revealed type is "__main__.A[builtins.int]"
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
2044
2044
2045
2045
2046
-
[builtins fixtures/attr.pyi]
2046
+
[builtins fixtures/plugin_attrs.pyi]
2047
2047
2048
2048
[case testEvolveTypeVarBound]
2049
2049
import attrs
@@ -2068,7 +2068,7 @@ def f(t: TA) -> TA:
2068
2068
f(A(x=42))
2069
2069
f(B(x=42))
2070
2070
2071
-
[builtins fixtures/attr.pyi]
2071
+
[builtins fixtures/plugin_attrs.pyi]
2072
2072
2073
2073
[case testEvolveTypeVarBoundNonAttrs]
2074
2074
import attrs
@@ -2091,7 +2091,7 @@ def h(t: TNone) -> None:
2091
2091
def x(t: TUnion) -> None:
2092
2092
_ = 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
2093
2093
2094
-
[builtins fixtures/attr.pyi]
2094
+
[builtins fixtures/plugin_attrs.pyi]
2095
2095
2096
2096
[case testEvolveTypeVarConstrained]
2097
2097
import attrs
@@ -2116,7 +2116,7 @@ def f(t: T) -> T:
2116
2116
f(A(x=42))
2117
2117
f(B(x='42'))
2118
2118
2119
-
[builtins fixtures/attr.pyi]
2119
+
[builtins fixtures/plugin_attrs.pyi]
2120
2120
2121
2121
[case testEvolveVariants]
2122
2122
from typing import Any
@@ -2139,5 +2139,5 @@ c = attrs.evolve(c, name=42) # E: Argument "name" to "evolve" of "C" has incomp
2139
2139
c = attrs.assoc(c, name='test')
2140
2140
c = attrs.assoc(c, name=42) # E: Argument "name" to "assoc" of "C" has incompatible type "int"; expected "str"
0 commit comments