Skip to content

Commit

Permalink
Test cli
Browse files Browse the repository at this point in the history
  • Loading branch information
Florents-Tselai committed Jun 23, 2024
1 parent 9d586b8 commit 1492e71
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .readthedocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ version: 2
build:
os: ubuntu-22.04
tools:
python: "3.11"
python: "3.12"

sphinx:
configuration: docs/conf.py
Expand Down
14 changes: 9 additions & 5 deletions tests/test_tsellm.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
from sqlite_utils import Database

import llm
from tsellm.cli import cli
import pytest
import datetime
from click.testing import CliRunner


def test_cli(db_path):
def test_tsellm_cli(db_path):
db = Database(db_path)
assert [] == db.table_names()
table = db.create_table(
Expand All @@ -28,3 +25,10 @@ def test_cli(db_path):
("hello",),
("world",),
]

cli([db_path, "UPDATE prompts SET generated=prompt(prompt)"])

assert db.execute("select prompt, generated from prompts").fetchall() == [
("hello", "hellohello"),
("world", "worldworld"),
]
2 changes: 0 additions & 2 deletions tsellm/cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,5 +126,3 @@ def cli(*args):
console.interact(banner, exitmsg="")
finally:
con.close()

sys.exit(0)

0 comments on commit 1492e71

Please sign in to comment.