From df9c6a1732a024dd35f96dc128ed56af21f5837b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Bj=C3=A4reholt?= Date: Sun, 5 Nov 2023 12:03:08 +0100 Subject: [PATCH] test: added test fileblock --- tests/test_cli.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/tests/test_cli.py b/tests/test_cli.py index 2fc9c276..51d0645a 100644 --- a/tests/test_cli.py +++ b/tests/test_cli.py @@ -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)