Added quick_complete convenience function

This commit is contained in:
Danilo Bargen
2013-01-03 23:10:35 +01:00
parent 23f36c86d7
commit 12b726c5a5
3 changed files with 43 additions and 2 deletions

View File

@@ -336,6 +336,27 @@ class TestFeature(Base):
any_re"""
self.assertEqual(self.get_def(s)[0].full_name, 're.RegexObject')
def test_quick_completion(self):
sources = [
('import json; json.l', (1, 19)),
('import json; json.l ', (1, 19)),
('import json\njson.l', (2, 6)),
('import json\njson.l ', (2, 6)),
('import json\njson.l\n\n', (2, 6)),
('import json\njson.l \n\n', (2, 6)),
('import json\njson.l \n \n\n', (2, 6)),
]
for source, pos in sources:
# Run quick_complete
quick_completions = api.quick_complete(source)
# Run real completion
script = api.Script(source, pos[0], pos[1], '')
real_completions = script.complete()
# Compare results
quick_values = [(c.full_name, c.line, c.column) for c in quick_completions]
real_values = [(c.full_name, c.line, c.column) for c in real_completions]
self.assertEqual(quick_values, real_values)
class TestSpeed(Base):
def _check_speed(time_per_run, number=4, run_warm=True):