Skip to content

Commit

Permalink
Test for logs --prompts
Browse files Browse the repository at this point in the history
  • Loading branch information
simonw committed Feb 2, 2025
1 parent 5081575 commit 314699c
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions tests/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,31 @@ def test_logs_extract_last_code(args, log_path):
assert result.output == 'print("hello word")\n\n'


def test_logs_prompts(log_path):
runner = CliRunner()
result = runner.invoke(cli, ["logs", "--prompts", "-p", str(log_path)])
assert result.exit_code == 0
output = datetime_re.sub("YYYY-MM-DDTHH:MM:SS", result.output)
expected = (
"- model: davinci\n"
" datetime: YYYY-MM-DDTHH:MM:SS\n"
" conversation: abc123\n"
" system: system\n"
" prompt: prompt\n"
"- model: davinci\n"
" datetime: YYYY-MM-DDTHH:MM:SS\n"
" conversation: abc123\n"
" system: system\n"
" prompt: prompt\n"
"- model: davinci\n"
" datetime: YYYY-MM-DDTHH:MM:SS\n"
" conversation: abc123\n"
" system: system\n"
" prompt: prompt\n"
)
assert output == expected


@pytest.mark.xfail(sys.platform == "win32", reason="Expected to fail on Windows")
@pytest.mark.parametrize("env", ({}, {"LLM_USER_PATH": "/tmp/llm-user-path"}))
def test_logs_path(monkeypatch, env, user_path):
Expand Down

0 comments on commit 314699c

Please sign in to comment.