Python: Expand dict update tests

This commit is contained in:
Rasmus Wriedt Larsen
2024-02-23 14:59:07 +01:00
parent dac2b57bb0
commit 0cf3fe4a4c
2 changed files with 15 additions and 3 deletions

View File

@@ -1,6 +1,9 @@
def func():
print("func()")
def func2():
print("func2()")
def return_func():
return func
@@ -32,6 +35,9 @@ f4() # $ tt=func
def return_func_in_dict_update():
d = {}
d["func"] = func
d["func2"] = func2
d["contested"] = func
d["contested"] = func2
return d
dct2 = return_func_in_dict_update() # $ pt,tt=return_func_in_dict_update
@@ -39,6 +45,10 @@ dct2 = return_func_in_dict_update() # $ pt,tt=return_func_in_dict_update
f5 = dct2['func']
f5() # $ tt=func
dct2['func2']() # $ tt=func2
dct2['contested']() # $ tt=func2 SPURIOUS: tt=func
def return_func_in_list():
return [func, 42]