Skip to content

Commit 8407082

Browse files
16bit-ykikoclaude
andcommitted
style(tests): apply ruff format
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 061dee4 commit 8407082

File tree

8 files changed

+57
-31
lines changed

8 files changed

+57
-31
lines changed

tests/integration/compilation/test_persistent_cache.py

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,14 @@
1616

1717
from tests.conftest import make_client, shutdown_client
1818
from tests.integration.utils import write_cdb, doc
19-
from tests.integration.utils.cache import list_pch_files, list_pcm_files, read_cache_json
19+
from tests.integration.utils.cache import (
20+
list_pch_files,
21+
list_pcm_files,
22+
read_cache_json,
23+
)
2024
from tests.integration.utils.assertions import assert_clean_compile
2125

2226

23-
2427
async def test_pch_written_to_cache_dir(client, tmp_path):
2528
"""After opening a file with #include, a .pch file should appear
2629
in .clice/cache/pch/ with a hex-hash filename."""

tests/integration/compilation/test_staleness.py

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
from tests.integration.utils.assertions import assert_clean_compile, assert_has_errors
2626

2727

28-
2928
async def test_header_change_invalidates_ast(client, tmp_path):
3029
"""Modifying a header on disk should cause recompilation on next hover,
3130
even though didSave was never called (mtime-based detection)."""
@@ -232,7 +231,6 @@ async def test_transitive_header_change(client, tmp_path):
232231
assert_has_errors(client, uri, "Expected diagnostics from transitive header change")
233232

234233

235-
236234
async def test_didchange_body_edit_recompiles(client, tmp_path):
237235
"""Editing the body (not preamble) via didChange should trigger
238236
recompilation and update diagnostics."""
@@ -317,7 +315,9 @@ async def test_didclose_then_reopen(client, tmp_path):
317315

318316
# Reopen — should compile the new (broken) content from disk.
319317
uri2, _ = await client.open_and_wait(tmp_path / "main.cpp")
320-
assert_has_errors(client, uri2, "Expected diagnostics after reopen with broken content")
318+
assert_has_errors(
319+
client, uri2, "Expected diagnostics after reopen with broken content"
320+
)
321321

322322

323323
async def test_didclose_clears_hover(client, tmp_path):
@@ -360,7 +360,9 @@ async def test_didsave_triggers_recompile_for_dependents(client, tmp_path):
360360
# Hover should detect the change and recompile.
361361
await wait_for_recompile(client, uri)
362362

363-
assert_has_errors(client, uri, "Expected diagnostics after didSave on broken header")
363+
assert_has_errors(
364+
client, uri, "Expected diagnostics after didSave on broken header"
365+
)
364366

365367

366368
async def test_didsave_with_module_deps(client, test_data_dir, tmp_path):

tests/integration/features/test_completion.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@
1313
from tests.integration.utils.workspace import did_change
1414

1515

16-
1716
@pytest.mark.workspace("include_completion")
1817
async def test_include_completion_quoted(client, workspace):
1918
"""Completion after #include " should list local headers."""
@@ -107,7 +106,6 @@ async def test_include_completion_empty_prefix(client, workspace):
107106
client.close(uri)
108107

109108

110-
111109
@pytest.mark.workspace("modules/chained_modules")
112110
async def test_import_completion_basic(client, workspace):
113111
"""Import completion should list known modules."""

tests/integration/features/test_index.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
from tests.integration.utils.wait import wait_for_index
1818

1919

20-
2120
@pytest.mark.workspace("index_features")
2221
async def test_goto_definition(client, workspace):
2322
"""Test GoToDefinition navigates from a call site to the function definition."""
@@ -38,7 +37,6 @@ async def test_goto_definition(client, workspace):
3837
client.close(uri)
3938

4039

41-
4240
@pytest.mark.workspace("index_features")
4341
async def test_find_references(client, workspace):
4442
"""Test FindReferences returns all usages of global_var."""
@@ -57,7 +55,6 @@ async def test_find_references(client, workspace):
5755
client.close(uri)
5856

5957

60-
6158
@pytest.mark.workspace("index_features")
6259
async def test_call_hierarchy_prepare(client, workspace):
6360
"""Test prepareCallHierarchy returns a CallHierarchyItem for 'add'."""
@@ -130,7 +127,6 @@ async def test_call_hierarchy_outgoing(client, workspace):
130127
client.close(uri)
131128

132129

133-
134130
@pytest.mark.workspace("index_features")
135131
async def test_type_hierarchy_prepare(client, workspace):
136132
"""Test prepareTypeHierarchy returns a TypeHierarchyItem for 'Dog'."""
@@ -204,7 +200,6 @@ async def test_type_hierarchy_subtypes(client, workspace):
204200
client.close(uri)
205201

206202

207-
208203
@pytest.mark.workspace("index_features")
209204
async def test_workspace_symbol(client, workspace):
210205
"""Test workspace/symbol finds symbols by query string."""

tests/integration/lifecycle/test_file_operation.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,11 +51,11 @@ async def test_hover_save_close(client, workspace):
5151
CompletionParams(text_document=doc(uri), position=Position(line=0, character=0))
5252
)
5353
await client.text_document_signature_help_async(
54-
SignatureHelpParams(text_document=doc(uri), position=Position(line=0, character=0))
55-
)
56-
client.text_document_did_close(
57-
DidCloseTextDocumentParams(text_document=doc(uri))
54+
SignatureHelpParams(
55+
text_document=doc(uri), position=Position(line=0, character=0)
56+
)
5857
)
58+
client.text_document_did_close(DidCloseTextDocumentParams(text_document=doc(uri)))
5959
closed_hover = await client.text_document_hover_async(
6060
HoverParams(text_document=doc(uri), position=Position(line=0, character=0))
6161
)

tests/integration/utils/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,11 @@
88
assert_diagnostics_count,
99
)
1010
from tests.integration.utils.wait import wait_for_recompile, wait_for_index
11-
from tests.integration.utils.cache import list_pch_files, list_pcm_files, read_cache_json
11+
from tests.integration.utils.cache import (
12+
list_pch_files,
13+
list_pcm_files,
14+
read_cache_json,
15+
)
1216

1317
__all__ = [
1418
"CliceClient",

tests/integration/utils/assertions.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,11 @@ def assert_has_errors(client, uri: str, msg: str = "") -> None:
2929

3030

3131
def assert_diagnostics_count(
32-
client, uri: str, count: int, *, severity: int | None = None,
32+
client,
33+
uri: str,
34+
count: int,
35+
*,
36+
severity: int | None = None,
3337
) -> None:
3438
"""Assert exact number of diagnostics, optionally filtered by severity."""
3539
diags = client.diagnostics.get(uri, [])

tests/integration/utils/client.py

Lines changed: 32 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -118,9 +118,7 @@ def open(self, filepath: Path, version: int = 0) -> tuple[str, str]:
118118
def close(self, uri: str) -> None:
119119
"""Close a text document."""
120120
self.text_document_did_close(
121-
DidCloseTextDocumentParams(
122-
text_document=TextDocumentIdentifier(uri=uri)
123-
)
121+
DidCloseTextDocumentParams(text_document=TextDocumentIdentifier(uri=uri))
124122
)
125123

126124
# ── Diagnostics ──────────────────────────────────────────────────
@@ -161,7 +159,9 @@ async def open_and_wait(
161159

162160
# ── Feature request shortcuts ────────────────────────────────────
163161

164-
async def hover_at(self, uri: str, line: int, character: int, *, timeout: float = 30.0):
162+
async def hover_at(
163+
self, uri: str, line: int, character: int, *, timeout: float = 30.0
164+
):
165165
"""Send hover request at given position."""
166166
return await asyncio.wait_for(
167167
self.text_document_hover_async(
@@ -173,7 +173,9 @@ async def hover_at(self, uri: str, line: int, character: int, *, timeout: float
173173
timeout=timeout,
174174
)
175175

176-
async def definition_at(self, uri: str, line: int, character: int, *, timeout: float = 30.0):
176+
async def definition_at(
177+
self, uri: str, line: int, character: int, *, timeout: float = 30.0
178+
):
177179
"""Send go-to-definition request at given position."""
178180
return await asyncio.wait_for(
179181
self.text_document_definition_async(
@@ -186,8 +188,13 @@ async def definition_at(self, uri: str, line: int, character: int, *, timeout: f
186188
)
187189

188190
async def references_at(
189-
self, uri: str, line: int, character: int,
190-
*, include_declaration: bool = True, timeout: float = 30.0,
191+
self,
192+
uri: str,
193+
line: int,
194+
character: int,
195+
*,
196+
include_declaration: bool = True,
197+
timeout: float = 30.0,
191198
):
192199
"""Send find-references request at given position."""
193200
return await asyncio.wait_for(
@@ -201,7 +208,9 @@ async def references_at(
201208
timeout=timeout,
202209
)
203210

204-
async def completion_at(self, uri: str, line: int, character: int, *, timeout: float = 30.0):
211+
async def completion_at(
212+
self, uri: str, line: int, character: int, *, timeout: float = 30.0
213+
):
205214
"""Send completion request at given position."""
206215
return await asyncio.wait_for(
207216
self.text_document_completion_async(
@@ -213,7 +222,9 @@ async def completion_at(self, uri: str, line: int, character: int, *, timeout: f
213222
timeout=timeout,
214223
)
215224

216-
async def signature_help_at(self, uri: str, line: int, character: int, *, timeout: float = 30.0):
225+
async def signature_help_at(
226+
self, uri: str, line: int, character: int, *, timeout: float = 30.0
227+
):
217228
"""Send signature help request at given position."""
218229
return await asyncio.wait_for(
219230
self.text_document_signature_help_async(
@@ -256,13 +267,20 @@ async def inlay_hints(self, uri: str, range_: Range, *, timeout: float = 30.0):
256267
"""Send inlay hint request for given range."""
257268
return await asyncio.wait_for(
258269
self.text_document_inlay_hint_async(
259-
InlayHintParams(text_document=TextDocumentIdentifier(uri=uri), range=range_)
270+
InlayHintParams(
271+
text_document=TextDocumentIdentifier(uri=uri), range=range_
272+
)
260273
),
261274
timeout=timeout,
262275
)
263276

264277
async def code_actions(
265-
self, uri: str, range_: Range, diagnostics=None, *, timeout: float = 30.0,
278+
self,
279+
uri: str,
280+
range_: Range,
281+
diagnostics=None,
282+
*,
283+
timeout: float = 30.0,
266284
):
267285
"""Send code action request."""
268286
return await asyncio.wait_for(
@@ -301,7 +319,9 @@ async def current_context(self, uri: str, *, timeout: float = 30.0):
301319
timeout=timeout,
302320
)
303321

304-
async def switch_context(self, uri: str, context_uri: str, *, timeout: float = 30.0):
322+
async def switch_context(
323+
self, uri: str, context_uri: str, *, timeout: float = 30.0
324+
):
305325
"""Send clice/switchContext extension request."""
306326
return await asyncio.wait_for(
307327
self.protocol.send_request_async(

0 commit comments

Comments
 (0)