Skip to content

Commit

Permalink
fix: AssertionError
Browse files Browse the repository at this point in the history
  • Loading branch information
khulnasoft-bot committed Jan 29, 2025
1 parent 3a25421 commit 67d9951
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 21 deletions.
4 changes: 2 additions & 2 deletions pr_insight/algo/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,8 +639,8 @@ def load_large_diff(filename, new_file_content_str: str, original_file_content_s
return ""

try:
original_file_content_str = (original_file_content_str or "").rstrip()
new_file_content_str = (new_file_content_str or "").rstrip()
original_file_content_str = (original_file_content_str or "").rstrip() + "\n"
new_file_content_str = (new_file_content_str or "").rstrip() + "\n"
diff = difflib.unified_diff(original_file_content_str.splitlines(keepends=True),
new_file_content_str.splitlines(keepends=True))
if get_settings().config.verbosity_level >= 2 and show_warning:
Expand Down
2 changes: 1 addition & 1 deletion tests/health_test/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@


async def run_async():
pr_url = os.getenv('TEST_PR_URL', 'https://github.com/Khulnasoft/pr-insight/pull/1385')
pr_url = os.getenv('TEST_PR_URL', 'https://github.com/Khulnasoft/pr-insight/pull/102')

get_settings().set("config.git_provider", "github")
get_settings().set("config.publish_output", False)
Expand Down
32 changes: 14 additions & 18 deletions tests/unittest/test_extend_patch.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,24 +163,20 @@ def test_extend_patches_with_extra_lines(self, token_handler, pr_languages):
class TestLoadLargeDiff:
def test_no_newline(self):
patch = load_large_diff("test.py",
"""\
old content 1
some new content
another line
""",
"""
old content 1
old content 2""")

patch_expected="""\
---
+++
@@ -1,3 +1,3 @@
- old content 1
- old content 2
+ old content 1
+ some new content
+ another line
"""old content 1
some new content
another line
""",
"""old content 1
old content 2""")

patch_expected = """---
+++
@@ -1,2 +1,3 @@
old content 1
-old content 2
+some new content
+another line
"""
assert patch == patch_expected

Expand Down

0 comments on commit 67d9951

Please sign in to comment.