forked from VimPlug/jedi
Make doctest work on Python 2.5
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user