void () { doTest("List[str]", """ expr = list() expr.append('a') """ ); doTest("List[Union[str, int]]", """ expr = list() expr.append('a') expr.append(1) """ ); doTest("List[Union[int, str]]", """ a = list([1, 2, 3]) a.append('a') expr = a """ ); doTest("List[Union[str, Any]]", """ expr = list() expr.append('a') expr.append(var) """ ); doTest("List[Union[int, str]]", """ expr = list([1, 2]) t, expr[1] = 23, 'b' """); doTest("List[Union[str, Any]]", """ expr = list(var) expr[0] = 'abc' """); doTest("List[Union[int, str]]", """ b, expr = 1, list([1, 2, 3]) expr.append('a') """ ); doTest("List[int]", """ def f(): expr = list([1, 2, 3]) def inner(): expr.append('a') """ ); }