Skip to content

Commit

Permalink
test: added test fileblock
Browse files Browse the repository at this point in the history
  • Loading branch information
ErikBjare committed Nov 5, 2023
1 parent e66d05b commit df9c6a1
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def test_command_fork(args: list[str], runner: CliRunner, name: str):
assert result.exit_code == 0


def test_fileblock(args: list[str], runner: CliRunner):
# tests saving with a ```filename.txt block
args.append(f"{CMDFIX}impersonate ```hello.py\nprint('hello')\n```")
result = runner.invoke(gptme.cli.main, args)
assert result.exit_code == 0

# read the file
with open("hello.py", "r") as f:
content = f.read()
assert content == "print('hello')\n"


def test_shell(args: list[str], runner: CliRunner):
args.append(f"{CMDFIX}shell echo 'yes'")
result = runner.invoke(gptme.cli.main, args)
Expand Down

0 comments on commit df9c6a1

Please sign in to comment.