Skip to content

Commit

Permalink
refactor: simplify origin initialization in test_llm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
NULL204 committed Feb 6, 2025
1 parent 520d620 commit e8501dd
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions tests/test_llm.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,13 @@

import pytest

from yuisub import ORIGIN, Summarizer, Translator, bangumi
from yuisub import Summarizer, Translator, bangumi

from . import util

origin = ORIGIN(
origin="何だよ…けっこう多いじゃねぇか",
)
origin = "何だよ…けっこう多いじゃねぇか"

summary_origin = ORIGIN(
origin="""
summary_origin = """
May I ask your name, miss?
Seriously, you stop that right now!
Uh... your grandfather seems very spry.
Expand All @@ -38,13 +35,12 @@
We'll be going now.
Thank you for your time.
"""
)


async def test_llm_none() -> None:
t = Translator(model=util.OPENAI_MODEL, api_key=util.OPENAI_API_KEY, base_url=util.OPENAI_BASE_URL)
print(t.system_prompt)
res = await t.ask(ORIGIN(origin=""))
res = await t.ask("")
assert res.zh == ""


Expand Down Expand Up @@ -82,9 +78,7 @@ async def test_llm_bangumi_2() -> None:
bangumi_info=await bangumi(url=util.BANGUMI_URL, token=util.BANGUMI_ACCESS_TOKEN),
)
print(t.system_prompt)
s = ORIGIN(
origin="♪ 星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と",
)
s = "♪ 星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と星と"

res = await t.ask(s)
print(res.zh)
Expand Down

0 comments on commit e8501dd

Please sign in to comment.