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: example for the autocompletion feature:
>>> import jedi >>> import jedi
>>> source = '''import json; json.l''' >>> source = '''
>>> script = jedi.Script(source, 1, 19, 'example.py') ... import datetime
... datetime.da'''
>>> script = jedi.Script(source, 3, len('datetime.da'), 'example.py')
>>> script >>> script
<Script: 'example.py'> <Script: 'example.py'>
>>> completions = script.complete() >>> completions = script.complete()
>>> completions >>> completions #doctest: +ELLIPSIS
[<Completion: load>, <Completion: loads>] [<Completion: date>, <Completion: datetime>, ...]
>>> print(completions[0].complete) >>> print(completions[0].complete)
oad te
>>> print(completions[0].word) >>> print(completions[0].word)
load date
As you see Jedi is pretty simple and allows you to concentrate on writing a 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. 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. Convenience function to complete a source string at the end.
Example:: Example:
>>> _quick_complete('import json\\njson.l') >>> _quick_complete('''
[<Completion: load>, <Completion: loads>] ... import datetime
... datetime.da''') #doctest: +ELLIPSIS
[<Completion: date>, <Completion: datetime>, ...]
:param source: The source code to be completed. :param source: The source code to be completed.
:type source: string :type source: string