From 328fa16d4d36396f5bc2b9e34742f73928f716e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 5 Nov 2023 12:46:12 +0100 Subject: [PATCH] test: added test for patch --- tests/test_cli.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 6e40ec9f..66c40907 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -125,6 +125,19 @@ def test_fileblock(args: list[str], runner: CliRunner): result = runner.invoke(gptme.cli.main, args) assert result.exit_code == 0 + # test patch on file in directory + args = args_orig.copy() + args.append( + f"{CMDFIX}impersonate ```patch hello/hello.py\n<<<<<<< ORIGINAL\nprint('hello')\n=======\nprint('hello world')\n>>>>>>> UPDATED\n```" + ) + result = runner.invoke(gptme.cli.main, args) + assert result.exit_code == 0 + + # read the file + with open("hello/hello.py", "r") as f: + content = f.read() + assert content == "print('hello world')\n" + def test_shell(args: list[str], runner: CliRunner): args.append(f"{CMDFIX}shell echo 'yes'")