1
0
forked from VimPlug/jedi

Make doctest work on Python 2.5

This commit is contained in:
Takafumi Arakaki
2013-02-26 10:58:24 +01:00
parent 6d2f7558fb
commit 9ba9e2c3a6
2 changed files with 13 additions and 9 deletions

View File

@@ -16,17 +16,19 @@ To give you a simple example how you can use the Jedi library, here is an
example for the autocompletion feature:
>>> import jedi
>>> source = '''import json; json.l'''
>>> script = jedi.Script(source, 1, 19, 'example.py')
>>> source = '''
... import datetime
... datetime.da'''
>>> script = jedi.Script(source, 3, len('datetime.da'), 'example.py')
>>> script
<Script: 'example.py'>
>>> completions = script.complete()
>>> completions
[<Completion: load>, <Completion: loads>]
>>> completions #doctest: +ELLIPSIS
[<Completion: date>, <Completion: datetime>, ...]
>>> print(completions[0].complete)
oad
te
>>> print(completions[0].word)
load
date
As you see Jedi is pretty simple and allows you to concentrate on writing a
good text editor, while still having very good IDE features for Python.

View File

@@ -485,10 +485,12 @@ def _quick_complete(source):
"""
Convenience function to complete a source string at the end.
Example::
Example:
>>> _quick_complete('import json\\njson.l')
[<Completion: load>, <Completion: loads>]
>>> _quick_complete('''
... import datetime
... datetime.da''') #doctest: +ELLIPSIS
[<Completion: date>, <Completion: datetime>, ...]
:param source: The source code to be completed.
:type source: string