void () { runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("UserId", """ from typing import NewType UserId = NewType('UserId', int) expr = UserId(12)""") ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("Type[UserId]", """ from typing import Dict, NewType UserId = NewType('UserId', Dict[int, str]) expr = UserId """) ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("(a: UserId) -> str", """ from typing import Dict, NewType UserId = NewType('UserId', int) def foo(a: UserId) -> str pass expr = foo """) ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("UserId", """ from typing import NewType as nt UserId = nt('UserId', int) expr = UserId(12) """) ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("UserId", """ import typing UserId = typing.NewType('UserId', int) expr = UserId(12) """) ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("UserId", """ import typing as t UserId = t.NewType('UserId', int) expr = UserId(12) """) ); runWithLanguageLevel( LanguageLevel.PYTHON36, () -> doTest("SuperId", """ from typing import NewType UserId = NewType('UserId', int) SuperId = NewType('SuperId', UserId) expr = SuperId(UserId(12)) """) ); }