@@ -360,7 +360,8 @@ class A:
360
360
361
361
a = A(5)
362
362
a.a = 16 # E: Property "a" defined in "A" is read-only
363
- [builtins fixtures/bool.pyi]
363
+ [builtins fixtures/plugin_attrs.pyi]
364
+
364
365
[case testAttrsNextGenFrozen]
365
366
from attr import frozen, field
366
367
@@ -370,7 +371,7 @@ class A:
370
371
371
372
a = A(5)
372
373
a.a = 16 # E: Property "a" defined in "A" is read-only
373
- [builtins fixtures/bool .pyi]
374
+ [builtins fixtures/plugin_attrs .pyi]
374
375
375
376
[case testAttrsNextGenDetect]
376
377
from attr import define, field
@@ -420,7 +421,7 @@ reveal_type(A) # N: Revealed type is "def (a: builtins.int, b: builtins.bool) -
420
421
reveal_type(B) # N: Revealed type is "def (a: builtins.bool, b: builtins.int) -> __main__.B"
421
422
reveal_type(C) # N: Revealed type is "def (a: builtins.int) -> __main__.C"
422
423
423
- [builtins fixtures/bool .pyi]
424
+ [builtins fixtures/plugin_attrs .pyi]
424
425
425
426
[case testAttrsDataClass]
426
427
import attr
@@ -1155,7 +1156,7 @@ c = NonFrozenFrozen(1, 2)
1155
1156
c.a = 17 # E: Property "a" defined in "NonFrozenFrozen" is read-only
1156
1157
c.b = 17 # E: Property "b" defined in "NonFrozenFrozen" is read-only
1157
1158
1158
- [builtins fixtures/bool .pyi]
1159
+ [builtins fixtures/plugin_attrs .pyi]
1159
1160
[case testAttrsCallableAttributes]
1160
1161
from typing import Callable
1161
1162
import attr
@@ -1178,7 +1179,7 @@ class G:
1178
1179
class FFrozen(F):
1179
1180
def bar(self) -> bool:
1180
1181
return self._cb(5, 6)
1181
- [builtins fixtures/callable .pyi]
1182
+ [builtins fixtures/plugin_attrs .pyi]
1182
1183
1183
1184
[case testAttrsWithFactory]
1184
1185
from typing import List
@@ -1450,7 +1451,7 @@ class C:
1450
1451
total = attr.ib(type=Bad) # E: Name "Bad" is not defined
1451
1452
1452
1453
C(0).total = 1 # E: Property "total" defined in "C" is read-only
1453
- [builtins fixtures/bool .pyi]
1454
+ [builtins fixtures/plugin_attrs .pyi]
1454
1455
1455
1456
[case testTypeInAttrDeferredStar]
1456
1457
import lib
@@ -1941,7 +1942,7 @@ class C:
1941
1942
default=None, converter=default_if_none(factory=dict) \
1942
1943
# E: Unsupported converter, only named functions, types and lambdas are currently supported
1943
1944
)
1944
- [builtins fixtures/dict .pyi]
1945
+ [builtins fixtures/plugin_attrs .pyi]
1945
1946
1946
1947
[case testAttrsUnannotatedConverter]
1947
1948
import attr
@@ -2012,7 +2013,7 @@ class Sub(Base):
2012
2013
2013
2014
@property
2014
2015
def name(self) -> str: ...
2015
- [builtins fixtures/property .pyi]
2016
+ [builtins fixtures/plugin_attrs .pyi]
2016
2017
2017
2018
[case testOverrideWithPropertyInFrozenClassChecked]
2018
2019
from attrs import frozen
@@ -2035,7 +2036,7 @@ class Sub(Base):
2035
2036
2036
2037
# This matches runtime semantics
2037
2038
reveal_type(Sub) # N: Revealed type is "def (*, name: builtins.str, first_name: builtins.str, last_name: builtins.str) -> __main__.Sub"
2038
- [builtins fixtures/property .pyi]
2039
+ [builtins fixtures/plugin_attrs .pyi]
2039
2040
2040
2041
[case testFinalInstanceAttribute]
2041
2042
from attrs import define
@@ -2342,6 +2343,12 @@ class A:
2342
2343
2343
2344
reveal_type(A.__hash__) # N: Revealed type is "def (self: builtins.object) -> builtins.int"
2344
2345
2346
+ @frozen(hash=False)
2347
+ class B:
2348
+ b: int
2349
+
2350
+ reveal_type(B.__hash__) # N: Revealed type is "None"
2351
+
2345
2352
[builtins fixtures/plugin_attrs.pyi]
2346
2353
2347
2354
[case testManualHashHashability]
@@ -2380,3 +2387,18 @@ class B(A):
2380
2387
reveal_type(B.__hash__) # N: Revealed type is "None"
2381
2388
2382
2389
[builtins fixtures/plugin_attrs.pyi]
2390
+
2391
+ [case testSubclassingFrozenHashability]
2392
+ from attrs import define, frozen
2393
+
2394
+ @define
2395
+ class A:
2396
+ a: int
2397
+
2398
+ @frozen
2399
+ class B(A):
2400
+ pass
2401
+
2402
+ reveal_type(B.__hash__) # N: Revealed type is "def (self: builtins.object) -> builtins.int"
2403
+
2404
+ [builtins fixtures/plugin_attrs.pyi]
0 commit comments