mirror of
https://github.com/davidhalter/jedi.git
synced 2025-12-08 06:44:46 +08:00
Attempt at a test of completion of filepath after ~.
I'm not quite sure how this will behave on windows, and we can't really create a tempdir (as we don't want to mess with path on home. One possibility would be to mock/monkeypatch scandir, listdir and os.path.expanduser or set $HOME in env; but I'm quite unsure we want to go that route.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
from os.path import join, sep as s
|
||||
from os.path import join, sep as s, expanduser
|
||||
import os
|
||||
import sys
|
||||
from textwrap import dedent
|
||||
|
||||
@@ -83,6 +84,14 @@ def test_loading_unicode_files_with_bad_global_charset(Script, monkeypatch, tmpd
|
||||
line=2, column=4, path=filename2)
|
||||
s.completions()
|
||||
|
||||
def test_complete_expanduser(Script):
|
||||
possibilities = os.listdir(expanduser('~'))
|
||||
non_dots = [p for p in possibilities if not p.startswith('.') and len(p) > 1]
|
||||
item = non_dots[0]
|
||||
line = "'~%s%s'" % (os.sep, item)
|
||||
s = Script(line, line=1, column=len(line)-1)
|
||||
assert item in [c.name for c in s.completions()]
|
||||
|
||||
|
||||
def test_fake_subnodes(Script):
|
||||
"""
|
||||
|
||||
Reference in New Issue
Block a user