Skip to content

Commit 43129c5

Browse files
committed
Add functional test for NewType member checking
#3162
1 parent c285fae commit 43129c5

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

tests/functional/m/member/member_checks.py

+9
Original file line numberDiff line numberDiff line change
@@ -231,3 +231,12 @@ class Animal(Enum):
231231
print(keyy)
232232
for vall in Animal.__members__.values():
233233
print(vall)
234+
235+
236+
from typing import NewType
237+
238+
UserId = NewType("UserId", str)
239+
240+
some_id = UserId("id")
241+
some_id.capitalize()
242+
some_id.not_a_str_method() # [no-member]

tests/functional/m/member/member_checks.txt

+1
Original file line numberDiff line numberDiff line change
@@ -17,3 +17,4 @@ no-member:135:0:135:18::Class 'str' has no 'portocala' member:INFERENCE
1717
no-member:170:19:170:32:NoDunderNameInInstance.__init__:Instance of 'NoDunderNameInInstance' has no '__name__' member:INFERENCE
1818
no-member:176:14:176:23:InvalidAccessBySlots.__init__:Instance of 'InvalidAccessBySlots' has no 'teta' member:INFERENCE
1919
no-member:208:13:208:20::Class 'Cls' has no 'BAZ' member; maybe 'BAR'?:INFERENCE
20+
no-member:242:0:242:24::Instance of 'UserId' has no 'not_a_str_method' member:INFERENCE

0 commit comments

Comments
 (0)