Skip to content

Commit

Permalink
test: added test for patch
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 5, 2023
1 parent b7b57b8 commit 328fa16
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'")
Expand Down

0 comments on commit 328fa16

Please sign in to comment.