Python: Add test of multi func def based on runtime decision

This commit is contained in:
Rasmus Wriedt Larsen
2022-10-24 16:31:39 +02:00
parent 276a825cd0
commit fb0cc184d9
3 changed files with 28 additions and 0 deletions

View File

@@ -15,6 +15,8 @@ pointsTo_found_typeTracker_notFound
| code/func_defined_outside_class.py:42:1:42:7 | ControlFlowNode for Attribute() | B._gen.func |
| code/func_defined_outside_class.py:43:1:43:7 | ControlFlowNode for Attribute() | B._gen.func |
| code/funky_regression.py:15:9:15:17 | ControlFlowNode for Attribute() | Wat.f2 |
| code/runtime_decision.py:44:1:44:7 | ControlFlowNode for func4() | "code/runtime_decision_defns.py:4:func4" |
| code/runtime_decision.py:44:1:44:7 | ControlFlowNode for func4() | "code/runtime_decision_defns.py:7:func4" |
| code/type_tracking_limitation.py:8:1:8:3 | ControlFlowNode for x() | my_func |
typeTracker_found_pointsTo_notFound
| code/callable_as_argument.py:29:5:29:12 | ControlFlowNode for Attribute() | test_class.InsideTestFunc.sm |

View File

@@ -24,3 +24,21 @@ else:
func2 = rd_bar
func2() # $ pt,tt=rd_foo pt,tt=rd_bar
# ==============================================================================
# definition is random
if random.random() < 0.5:
def func3():
print("func3 A")
else:
def func3():
print("func3 B")
func3() # $ pt,tt=33:func3 pt,tt=36:func3
# func4 uses same setup as func3, it's just defined in an other file
from code.runtime_decision_defns import func4
func4() # $ pt="code/runtime_decision_defns.py:4:func4" pt="code/runtime_decision_defns.py:7:func4" MISSING: tt

View File

@@ -0,0 +1,8 @@
import random
if random.random() < 0.5:
def func4():
print("func4 A")
else:
def func4():
print("func4 B")