1
0
forked from VimPlug/jedi

Test that no repr() can slow down completion.

Was reported with issue #919.
This commit is contained in:
Élie Gouzien
2017-05-06 14:14:56 +02:00
committed by Dave Halter
parent a78769954d
commit 9d5cc0be06

View File

@@ -51,3 +51,19 @@ class TestSpeed(TestCase):
with open('speed/precedence.py') as f:
line = len(f.read().splitlines())
assert jedi.Script(line=line, path='speed/precedence.py').goto_definitions()
@_check_speed(0.1)
def test_no_repr_computation(self):
"""
For Interpreter completion aquisition of sourcefile can trigger
unwanted computation of repr(). Exemple : big pandas data.
See issue #919.
"""
class Slow_repr():
"class to test what happens if __repr__ is very slow."
def some_method(self):
pass
def __repr__(self):
time.sleep(0.2)
test = Slow_repr()
jedi.Interpreter('test.som', [locals()]).completions()