Skip to content

Commit 7e51c68

Browse files
committed
style: Format code according to linter rules
1 parent 3b376a1 commit 7e51c68

1 file changed

Lines changed: 27 additions & 26 deletions

File tree

tests/basic/test_coder.py

Lines changed: 27 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,12 @@ def test_check_for_subdir_mention(self):
284284
coder.check_for_file_mentions(f"Please check `{fname}`")
285285

286286
self.assertEqual(coder.abs_fnames, set([str(fname.resolve())]))
287-
287+
288288
def test_get_file_mentions_various_formats(self):
289289
with GitTemporaryDirectory():
290290
io = InputOutput(pretty=False, yes=True)
291291
coder = Coder.create(self.GPT35, None, io)
292-
292+
293293
# Create test files
294294
test_files = [
295295
"file1.txt",
@@ -299,65 +299,66 @@ def test_get_file_mentions_various_formats(self):
299299
"file with spaces.txt",
300300
"special_chars!@#.md",
301301
]
302-
302+
303303
for fname in test_files:
304304
fpath = Path(fname)
305305
fpath.parent.mkdir(parents=True, exist_ok=True)
306306
fpath.touch()
307-
307+
308308
# Mock get_addable_relative_files to return our test files
309309
coder.get_addable_relative_files = MagicMock(return_value=set(test_files))
310-
310+
311311
# Test different mention formats
312312
test_cases = [
313313
# Simple plain text mentions
314314
(f"You should edit {test_files[0]} first", {test_files[0]}),
315-
316315
# Multiple files in plain text
317316
(f"Edit both {test_files[0]} and {test_files[1]}", {test_files[0], test_files[1]}),
318-
319317
# Files in backticks
320318
(f"Check the file `{test_files[2]}`", {test_files[2]}),
321-
322319
# Files in code blocks
323320
(f"```\n{test_files[3]}\n```", {test_files[3]}),
324-
325321
# Files in code blocks with language specifier
326-
(f"```python\nwith open('{test_files[1]}', 'r') as f:\n data = f.read()\n```", {test_files[1]}),
327-
322+
(
323+
f"```python\nwith open('{test_files[1]}', 'r') as f:\n data = f.read()\n```",
324+
{test_files[1]},
325+
),
328326
# Files with Windows-style paths
329327
(f"Edit the file {test_files[2].replace('/', '\\')}", {test_files[2]}),
330-
331328
# Files with spaces
332329
(f"Look at '{test_files[4]}'", {test_files[4]}),
333-
334330
# Files with different quote styles
335331
(f'Check "{test_files[5]}" now', {test_files[5]}),
336-
337332
# Files mentioned in markdown links
338333
(f"See the file [{test_files[0]}]({test_files[0]})", {test_files[0]}),
339-
340334
# All files in one complex message
341335
(
342-
f"First, edit `{test_files[0]}`. Then modify {test_files[1]}.\n"
343-
f"```js\n// Update this file\nconst file = '{test_files[2]}';\n```\n"
344-
f"Finally check {test_files[3].replace('/', '\\')}",
345-
{test_files[0], test_files[1], test_files[2], test_files[3]}
336+
(
337+
f"First, edit `{test_files[0]}`. Then modify {test_files[1]}.\n"
338+
f"```js\n// Update this file\nconst file = '{test_files[2]}';\n```\n"
339+
f"Finally check {test_files[3].replace('/', '\\')}"
340+
),
341+
{test_files[0], test_files[1], test_files[2], test_files[3]},
346342
),
347-
348343
# Mention with SEARCH/REPLACE format
349344
(
350-
f"{test_files[1]}\n````python\n<<<<<<< SEARCH\ndef old_function():\n pass\n=======\n"
351-
f"def new_function():\n return True\n>>>>>>> REPLACE\n````",
352-
{test_files[1]}
345+
(
346+
f"{test_files[1]}\n````python\n<<<<<<< SEARCH\ndef old_function():\n "
347+
" pass\n=======\ndef new_function():\n return True\n>>>>>>>"
348+
" REPLACE\n````"
349+
),
350+
{test_files[1]},
353351
),
354352
]
355-
353+
356354
for content, expected_mentions in test_cases:
357355
with self.subTest(content=content):
358356
mentioned_files = coder.get_file_mentions(content)
359-
self.assertEqual(mentioned_files, expected_mentions,
360-
f"Failed to extract mentions from: {content}")
357+
self.assertEqual(
358+
mentioned_files,
359+
expected_mentions,
360+
f"Failed to extract mentions from: {content}",
361+
)
361362

362363
def test_get_file_mentions_path_formats(self):
363364
with GitTemporaryDirectory():

0 commit comments

Comments
 (0)