mirror of
https://github.com/Aider-AI/aider.git
synced 2025-05-25 23:05:00 +00:00
style: Format Python code using linter
This commit is contained in:
parent
210a9e5a49
commit
1ee481f4ea
1 changed files with 17 additions and 16 deletions
|
@ -1,10 +1,10 @@
|
||||||
#!/usr/bin/env python3
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
import re
|
import difflib
|
||||||
import sys
|
|
||||||
import io
|
import io
|
||||||
import os
|
import os
|
||||||
import difflib
|
import re
|
||||||
|
import sys
|
||||||
import unittest
|
import unittest
|
||||||
|
|
||||||
from aider.coders.base_coder import all_fences
|
from aider.coders.base_coder import all_fences
|
||||||
|
@ -65,10 +65,10 @@ def process_markdown(filename, fh):
|
||||||
class TestFindOrBlocks(unittest.TestCase):
|
class TestFindOrBlocks(unittest.TestCase):
|
||||||
def test_process_markdown(self):
|
def test_process_markdown(self):
|
||||||
# Path to the input markdown file
|
# Path to the input markdown file
|
||||||
input_file = 'tests/fixtures/chat-history.md'
|
input_file = "tests/fixtures/chat-history.md"
|
||||||
|
|
||||||
# Path to the expected output file
|
# Path to the expected output file
|
||||||
expected_output_file = 'tests/fixtures/chat-history-search-replace-gold.txt'
|
expected_output_file = "tests/fixtures/chat-history-search-replace-gold.txt"
|
||||||
|
|
||||||
# Create a StringIO object to capture the output
|
# Create a StringIO object to capture the output
|
||||||
output = io.StringIO()
|
output = io.StringIO()
|
||||||
|
@ -80,7 +80,7 @@ class TestFindOrBlocks(unittest.TestCase):
|
||||||
actual_output = output.getvalue()
|
actual_output = output.getvalue()
|
||||||
|
|
||||||
# Read the expected output
|
# Read the expected output
|
||||||
with open(expected_output_file, 'r') as f:
|
with open(expected_output_file, "r") as f:
|
||||||
expected_output = f.read()
|
expected_output = f.read()
|
||||||
|
|
||||||
# Compare the actual and expected outputs
|
# Compare the actual and expected outputs
|
||||||
|
@ -90,15 +90,16 @@ class TestFindOrBlocks(unittest.TestCase):
|
||||||
expected_output.splitlines(keepends=True),
|
expected_output.splitlines(keepends=True),
|
||||||
actual_output.splitlines(keepends=True),
|
actual_output.splitlines(keepends=True),
|
||||||
fromfile=expected_output_file,
|
fromfile=expected_output_file,
|
||||||
tofile='actual output'
|
tofile="actual output",
|
||||||
)
|
)
|
||||||
|
|
||||||
# Join the diff lines into a string
|
# Join the diff lines into a string
|
||||||
diff_text = ''.join(diff)
|
diff_text = "".join(diff)
|
||||||
|
|
||||||
# Fail the test and show the diff
|
# Fail the test and show the diff
|
||||||
self.fail(f"Output doesn't match expected output. Diff:\n{diff_text}")
|
self.fail(f"Output doesn't match expected output. Diff:\n{diff_text}")
|
||||||
|
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
if len(sys.argv) != 2:
|
if len(sys.argv) != 2:
|
||||||
print("Usage: python testsr.py <markdown_filename>")
|
print("Usage: python testsr.py <markdown_filename>")
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue