void () { runWithLanguageLevel( LanguageLevel.PYTHON35, () -> { doTest("Literal[True]", "from typing_extensions import Literal\n" + "expr: Literal[True] = False"); doTest("bool", "from typing_extensions import Literal\n" + "expr: Literal[] = False"); doTest("bool", "from typing_extensions import Literal\n" + "expr: Literal = False"); doTest("bool", "expr = False"); } ); doTest("Literal[10]", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal[10]"); doTest("Literal[-10]", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal[-10]"); doTest("int", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal[10.5]"); doTest("int", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal[10j]"); doTest("int", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal[]"); doTest("int", "from typing_extensions import Literal\n" + "expr = 20 # type: Literal"); doTest("int", "from typing_extensions import Literal\n" + "expr = 20"); }