forked from VimPlug/jedi
fix a problem with empty scripts
This commit is contained in:
@@ -60,7 +60,7 @@ class Script(object):
|
|||||||
warnings.warn("Use path instead of source_path.", DeprecationWarning)
|
warnings.warn("Use path instead of source_path.", DeprecationWarning)
|
||||||
path = source_path
|
path = source_path
|
||||||
|
|
||||||
lines = source.splitlines()
|
lines = source.splitlines() or ['']
|
||||||
if source and source[-1] == '\n':
|
if source and source[-1] == '\n':
|
||||||
lines.append('')
|
lines.append('')
|
||||||
|
|
||||||
|
|||||||
@@ -24,3 +24,7 @@ def test_preload_modules():
|
|||||||
check_loaded('datetime', 'json', 'token')
|
check_loaded('datetime', 'json', 'token')
|
||||||
|
|
||||||
cache.parser_cache = temp_cache
|
cache.parser_cache = temp_cache
|
||||||
|
|
||||||
|
|
||||||
|
def test_empty_script():
|
||||||
|
assert api.Script('')
|
||||||
|
|||||||
Reference in New Issue
Block a user