Skip to content

Commit

Permalink
Updates tests
Browse files Browse the repository at this point in the history
  • Loading branch information
edgararuiz committed Oct 16, 2024
1 parent df29d4c commit 7b26ac4
Show file tree
Hide file tree
Showing 7 changed files with 15 additions and 14 deletions.
3 changes: 1 addition & 2 deletions python/mall/llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,7 @@ def llm_call(x, msg, use, preview=False, valid_resps="", convert=None, data_type
options=use.get("options"),
)

if preview:
print(call)
if preview: print(call)

cache = ""
if use.get("_cache") != "":
Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_classify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_classify():
Expand Down
11 changes: 9 additions & 2 deletions python/tests/test_extract.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_extract_list():
Expand Down Expand Up @@ -36,3 +35,11 @@ def test_extract_one():
x["extract"][0]
== "You are a helpful text extraction engine. Extract the a being referred to on the text. I expect 1 item exactly. No capitalization. No explanations. The answer is based on the following text:\n{}"
)

def test_extract_expand():
df = pl.DataFrame(dict(x="x | y"))
df.llm.use("test", "echo", _cache="_test_cache")
x = df.llm.extract("x", ["a", "b"], expand_cols = True)
assert (
x["a"][0] == "x "
)
3 changes: 1 addition & 2 deletions python/tests/test_sentiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_sentiment_simple():
Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_summarize.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_summarize_prompt():
Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_translate.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_translate_prompt():
Expand Down
3 changes: 1 addition & 2 deletions python/tests/test_verify.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@
import shutil
import os

if os._exists("_test_cache"):
shutil.rmtree("_test_cache", ignore_errors=True)
if os._exists("_test_cache"): shutil.rmtree("_test_cache", ignore_errors=True)


def test_verify():
Expand Down

0 comments on commit 7b26ac4

Please sign in to comment.