Skip to content

Commit ef16189

Browse files
committed
Add test for NewType and Any
1 parent 9ebae1b commit ef16189

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

test-data/unit/check-newtype.test

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -250,6 +250,11 @@ main:8: error: Argument 1 to NewType(...) must be a positional string literal
250250
main:8: error: Argument 2 to NewType(...) must be a positional type
251251
main:9: error: Argument 2 to NewType(...) must be a positional type
252252

253+
[case testNewTypeWithAnyFails]
254+
from typing import NewType, Any
255+
A = NewType('A', Any) # E: Argument 2 to NewType(...) must be subclassable (got Any)
256+
[out]
257+
253258
[case testNewTypeWithUnionsFails]
254259
from typing import NewType, Union
255260
Foo = NewType('Foo', Union[int, float]) # E: Argument 2 to NewType(...) must be subclassable (got Union[builtins.int, builtins.float])

0 commit comments

Comments
 (0)