forked from VimPlug/jedi
Test that no repr() can slow down completion.
Was reported with issue #919.
This commit is contained in:
committed by
Dave Halter
parent
a78769954d
commit
9d5cc0be06
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user