void () { doTest("List[int]", """ def f(): expr = [] expr.append(42) expr.append(0)""" ); doTest("List[Union[str, int]]", """ def f(): expr = [] expr.append('a') expr.append(1)""" ); doTest("List[Union[Union[int, str], Any]]", "expr = [3, 4, 5, 6, 7, 8, 9, 1, 2, 3, 4]\n" + "expr.append('a')" ); doTest("List[Union[int, str]]", """ expr = [1, 2] expr.append(42) expr.extend(['a']""" ); doTest("List[Union[int, str, None]]", "expr = []\n" + "expr.extend([1, 'a', None])" ); doTest("List[int]", "expr = []\n" + "expr.index(42)"); doTest("List[int]", "expr = [1, 2, 3]\n"); doTest("List[Union[int, Any]]", """ expr = [1, 2, 3] expr.append(var) """); doTest("List[Union[int, str]]", """ expr = [1, 2, 3] expr[0] = 'a' expr[1] = 'b' """); doTest("List[Union[int, str]]", """ expr = [1, 2, 3] expr[0] = 'a' expr[1] = 'b' """); doTest("List[Union[int, str]]", """ expr = [1, 2] t, expr[1] = 23, 'b' """); doTest("List[Union[int, str]]", """ def f(): expr, b = [1, 2, 3], 'abc' expr.append('a') """ ); doTest("List[int]", """ def f(): expr = [1, 2, 3] def inner(): expr.append('a') """ ); }