Skip to content

Commit 9efbe84

Browse files
committed
Update tests
1 parent a57ba07 commit 9efbe84

File tree

4 files changed

+21
-20
lines changed

4 files changed

+21
-20
lines changed
File renamed without changes.
File renamed without changes.

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ install_requires = python-lsp-server; black>=19.3b0; toml
1818
python_requires = >= 3.6
1919

2020
[options.entry_points]
21-
pyls = pyls_black = pyls_black.plugin
21+
pylsp = pylsp_black = pylsp_black.plugin
2222

2323
[options.extras_require]
2424
dev = isort>=5.0; flake8; pytest; mypy; pytest

tests/test_plugin.py

Lines changed: 20 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@
88
from pylsp import uris
99
from pylsp.workspace import Document, Workspace
1010

11-
from pyls_black.plugin import load_config, pyls_format_document, pyls_format_range
11+
from pylsp_black.plugin import load_config, pylsp_format_document, pylsp_format_range
12+
1213

1314
here = Path(__file__).parent
1415
fixtures_dir = here / "fixtures"
@@ -62,8 +63,8 @@ def config_document(workspace):
6263
return Document(uri, workspace)
6364

6465

65-
def test_pyls_format_document(unformatted_document, formatted_document):
66-
result = pyls_format_document(unformatted_document)
66+
def test_pylsp_format_document(unformatted_document, formatted_document):
67+
result = pylsp_format_document(unformatted_document)
6768

6869
assert result == [
6970
{
@@ -77,7 +78,7 @@ def test_pyls_format_document(unformatted_document, formatted_document):
7778

7879

7980
def test_pyls_format_pyi_document(unformatted_pyi_document, formatted_pyi_document):
80-
result = pyls_format_document(unformatted_pyi_document)
81+
result = pylsp_format_document(unformatted_pyi_document)
8182

8283
assert result == [
8384
{
@@ -90,26 +91,26 @@ def test_pyls_format_pyi_document(unformatted_pyi_document, formatted_pyi_docume
9091
]
9192

9293

93-
def test_pyls_format_document_unchanged(formatted_document):
94-
result = pyls_format_document(formatted_document)
94+
def test_pylsp_format_document_unchanged(formatted_document):
95+
result = pylsp_format_document(formatted_document)
9596

9697
assert result == []
9798

9899

99100
def test_pyls_format_pyi_document_unchanged(formatted_pyi_document):
100-
result = pyls_format_document(formatted_pyi_document)
101+
result = pylsp_format_document(formatted_pyi_document)
101102

102103
assert result == []
103104

104105

105-
def test_pyls_format_document_syntax_error(invalid_document):
106-
result = pyls_format_document(invalid_document)
106+
def test_pylsp_format_document_syntax_error(invalid_document):
107+
result = pylsp_format_document(invalid_document)
107108

108109
assert result == []
109110

110111

111-
def test_pyls_format_document_with_config(config_document):
112-
result = pyls_format_document(config_document)
112+
def test_pylsp_format_document_with_config(config_document):
113+
result = pylsp_format_document(config_document)
113114

114115
assert result == [
115116
{
@@ -134,13 +135,13 @@ def test_pyls_format_document_with_config(config_document):
134135
("start", "end", "expected"),
135136
[(0, 0, 'a = "hello"\n'), (1, 1, "b = 42\n"), (0, 1, 'a = "hello"\nb = 42\n')],
136137
)
137-
def test_pyls_format_range(unformatted_document, start, end, expected):
138+
def test_pylsp_format_range(unformatted_document, start, end, expected):
138139
range = {
139140
"start": {"line": start, "character": 0},
140141
"end": {"line": end, "character": 0},
141142
}
142143

143-
result = pyls_format_range(unformatted_document, range=range)
144+
result = pylsp_format_range(unformatted_document, range=range)
144145

145146
assert result == [
146147
{
@@ -153,18 +154,18 @@ def test_pyls_format_range(unformatted_document, start, end, expected):
153154
]
154155

155156

156-
def test_pyls_format_range_unchanged(formatted_document):
157+
def test_pylsp_format_range_unchanged(formatted_document):
157158
range = {"start": {"line": 0, "character": 0}, "end": {"line": 1, "character": 0}}
158159

159-
result = pyls_format_range(formatted_document, range=range)
160+
result = pylsp_format_range(formatted_document, range=range)
160161

161162
assert result == []
162163

163164

164-
def test_pyls_format_range_syntax_error(invalid_document):
165+
def test_pylsp_format_range_syntax_error(invalid_document):
165166
range = {"start": {"line": 0, "character": 0}, "end": {"line": 1, "character": 0}}
166167

167-
result = pyls_format_range(invalid_document, range=range)
168+
result = pylsp_format_range(invalid_document, range=range)
168169

169170
assert result == []
170171

@@ -207,8 +208,8 @@ def test_load_config_defaults():
207208

208209

209210
def test_entry_point():
210-
distribution = pkg_resources.get_distribution("pyls-black")
211-
entry_point = distribution.get_entry_info("pyls", "pyls_black")
211+
distribution = pkg_resources.get_distribution("python-lsp-black")
212+
entry_point = distribution.get_entry_info("pylsp", "pylsp_black")
212213

213214
assert entry_point is not None
214215

0 commit comments

Comments
 (0)