Skip to content

Commit 8c84c74

Browse files
kopekCgithub-actions[bot]
authored andcommitted
Automated pre-commit update
1 parent 1d9211f commit 8c84c74

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

tests/unit/codegen/extensions/test_tools.py

Lines changed: 9 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ def large_codebase(tmpdir):
6868
for i in range(1, 401): # This will create a 400+ line file
6969
if i % 20 == 0:
7070
# Add some class methods periodically
71-
large_file_lines.extend(
72-
[" @classmethod", f" def class_method_{i}(cls) -> None:", f" print('Class method {i}')", " return None", ""])
71+
large_file_lines.extend([" @classmethod", f" def class_method_{i}(cls) -> None:", f" print('Class method {i}')", " return None", ""])
7372
else:
7473
# Add regular methods
7574
large_file_lines.extend(
@@ -124,8 +123,7 @@ def test_view_file_pagination(large_codebase):
124123
assert "def method_251" not in result.content # Method after page 1
125124

126125
# Test custom pagination range
127-
result = view_file(large_codebase, "src/large_file.py",
128-
start_line=200, end_line=250)
126+
result = view_file(large_codebase, "src/large_file.py", start_line=200, end_line=250)
129127
assert result.status == "success"
130128
assert result.start_line == 200
131129
assert result.end_line == 250
@@ -158,8 +156,7 @@ def test_view_file_pagination(large_codebase):
158156
assert len(result.content.splitlines()) <= 100
159157

160158
# Test line numbers display
161-
result = view_file(large_codebase, "src/large_file.py",
162-
start_line=198, end_line=202, line_numbers=True)
159+
result = view_file(large_codebase, "src/large_file.py", start_line=198, end_line=202, line_numbers=True)
163160
assert result.status == "success"
164161
assert "198|" in result.content
165162
assert "199|" in result.content
@@ -168,8 +165,7 @@ def test_view_file_pagination(large_codebase):
168165
assert "202|" in result.content
169166

170167
# Test without line numbers
171-
result = view_file(large_codebase, "src/large_file.py",
172-
start_line=198, end_line=202, line_numbers=False)
168+
result = view_file(large_codebase, "src/large_file.py", start_line=198, end_line=202, line_numbers=False)
173169
assert result.status == "success"
174170
assert "198|" not in result.content
175171
assert "199|" not in result.content
@@ -178,8 +174,7 @@ def test_view_file_pagination(large_codebase):
178174
def test_view_file_pagination_edge_cases(large_codebase):
179175
"""Test edge cases for file pagination."""
180176
# Test start_line > end_line (should respect provided end_line)
181-
result = view_file(large_codebase, "src/large_file.py",
182-
start_line=200, end_line=100)
177+
result = view_file(large_codebase, "src/large_file.py", start_line=200, end_line=100)
183178
assert result.status == "success"
184179
assert result.start_line == 200
185180
assert result.end_line == 100 # Should respect provided end_line
@@ -193,8 +188,7 @@ def test_view_file_pagination_edge_cases(large_codebase):
193188
assert result.has_more is False
194189

195190
# Test end_line > file length (should truncate to file length)
196-
result = view_file(large_codebase, "src/large_file.py",
197-
start_line=200, end_line=2000)
191+
result = view_file(large_codebase, "src/large_file.py", start_line=200, end_line=2000)
198192
assert result.status == "success"
199193
assert result.start_line == 200
200194
# Should respect max_lines and file length
@@ -249,8 +243,7 @@ def test_search(codebase):
249243
assert len(result.results) > 0
250244

251245
# Check that we found the right content
252-
assert any("hello" in match.match.lower()
253-
for file_result in result.results for match in file_result.matches)
246+
assert any("hello" in match.match.lower() for file_result in result.results for match in file_result.matches)
254247

255248
# Check pagination info
256249
assert result.page == 1
@@ -266,8 +259,7 @@ def test_search_regex(codebase):
266259
assert len(result.results) > 0
267260

268261
# Should find both 'def hello' and 'def greet'
269-
matches = [
270-
match.line for file_result in result.results for match in file_result.matches]
262+
matches = [match.line for file_result in result.results for match in file_result.matches]
271263
assert any("def hello" in match for match in matches)
272264
assert any("def greet" in match for match in matches)
273265

@@ -291,8 +283,7 @@ def test_search_pagination(codebase, tmpdir):
291283
# If we have enough results for multiple pages
292284
if result_page1.total_pages > 1:
293285
# Get page 2
294-
result_page2 = search(pagination_codebase,
295-
"Hello", page=2, files_per_page=5)
286+
result_page2 = search(pagination_codebase, "Hello", page=2, files_per_page=5)
296287
assert result_page2.status == "success"
297288
assert result_page2.page == 2
298289
assert len(result_page2.results) <= 5

0 commit comments

Comments
 (0)