Skip to content

Commit 2305b3a

Browse files
committed
Add test for symbols of a non-existing (unsaved) file
Add a test for `textDocument/documentSymbols` of a non-existing (unsaved) file. The test fails as of this commit and is a regression test for issue python-lsp#301 [1]. [1] python-lsp#301
1 parent cd9941c commit 2305b3a

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

Diff for: test/plugins/test_symbols.py

+10
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,16 @@ def test_symbols_all_scopes(config, workspace):
8080
helper_check_symbols_all_scope(symbols)
8181

8282

83+
def test_symbols_non_existing_file(config, workspace, tmpdir):
84+
path = tmpdir.join("foo.py")
85+
# Check pre-condition: file must not exist
86+
assert not path.check(exists=1)
87+
88+
doc = Document(uris.from_fs_path(str(path)), workspace, DOC)
89+
symbols = pylsp_document_symbols(config, doc)
90+
helper_check_symbols_all_scope(symbols)
91+
92+
8393
@pytest.mark.skipif(PY2 or not LINUX or not CI, reason="tested on linux and python 3 only")
8494
def test_symbols_all_scopes_with_jedi_environment(workspace):
8595
doc = Document(DOC_URI, workspace, DOC)

0 commit comments

Comments
 (0)