void () { doTest("List[int]", "expr = range(10)\n"); doTest("List[Union[int, str]]", "expr = range(10)\n" + "expr.append('a')"); doTest("List[Union[int, Any]]", """ expr = range(10) expr.append(var) """); doTest("List[Union[int, str]]", """ expr = range(10) expr[0] = 'a' """); doTest("List[Union[int, str, None]]", "expr = range(10)\n" + "expr.extend(['a', None])"); doTest("List[Union[int, str]]", "expr = range(10)\n" + "expr.index('a')"); }