def test_call_added(self): source = parse( "results = []", "results.append(x)", ) add_list_calls(source) assert len(source.scopes[-1].vars[0].calls) == 1
def test_is_list(): source = parse( "list1 = []", "list2 = list1", ) add_list_calls(source) list2 = source.body[1] assert is_list(list2)
def test_global_list_assignment_with_later_append(self): source = parse( "results = []", "def add_x():", " results.append(2)", ) add_list_calls(source) results = source.body[0] t = value_type(results) assert t == "2"
def test_list_assignment_with_append_unknown_value(self): source = parse( "results = []", "x = 3", "results.append(x)", ) add_list_calls(source) results = source.body[0] t = value_type(results) assert t == "3"
def test_list_assignment_based_on_later_append(self): source = parse( "x = 3", "results = []", "results.append(x)", ) add_list_calls(source) results = source.body[1] t = value_type(results) assert t == "3"
def test_decltype_list_var(): source = parse( "results = []", "x = 3", "results.append(x)", ) add_list_calls(source) results = source.body[0] t = decltype(results) assert t == "std::vector<decltype(3)>"