mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
fix function execution mutable list issue
This commit is contained in:
20
test/test_evaluate/test_representation.py
Normal file
20
test/test_evaluate/test_representation.py
Normal file
@@ -0,0 +1,20 @@
|
||||
from jedi import Script
|
||||
|
||||
|
||||
def test_function_execution():
|
||||
"""
|
||||
We've been having an issue of a mutable list that was changed inside the
|
||||
function execution. Test if an execution always returns the same result.
|
||||
"""
|
||||
|
||||
s = """
|
||||
def x():
|
||||
return str()
|
||||
x"""
|
||||
d = Script(s).goto_definitions()[0]
|
||||
# Now just use the internals of the result (easiest way to get a fully
|
||||
# usable function).
|
||||
func, evaluator = d._definition, d._evaluator
|
||||
# Should return the same result both times.
|
||||
assert len(evaluator.execute(func)) == 1
|
||||
assert len(evaluator.execute(func)) == 1
|
||||
Reference in New Issue
Block a user