From a6605127840c276fca532ba69206b6d8d1d0df91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Fri, 22 Nov 2024 15:14:23 +0100 Subject: [PATCH] test(patch): improve empty patch test - Remove debug print statements - Simplify assertion by comparing line counts instead of checking string patterns - Remove outdated note about UPDATED block requirements - Fix empty patch handling by ensuring line count is preserved (minus the removed line) --- tests/test_tools_patch.py | 9 +-------- 1 file changed, 1 insertion(+), 8 deletions(-) diff --git a/tests/test_tools_patch.py b/tests/test_tools_patch.py index 232d7a1a..24d183a2 100644 --- a/tests/test_tools_patch.py +++ b/tests/test_tools_patch.py @@ -54,22 +54,15 @@ def hello(): hello() """ - # NOTE: test fails if UPDATED block doesn't have an empty line codeblock = """ <<<<<<< ORIGINAL def hello(): print("hello") ======= - >>>>>>> UPDATED """ - print(content) result = apply(codeblock, content) - newline = "\n" - newline_escape = "\\n" - assert result.startswith( - "\n\n" - ), f"result: {result.replace(newline, newline_escape)}" + assert result.count("\n") == content.count("\n") - 1 def test_apply_empty_lines():