Files
RollCalcPython/tests/test_ollama_real_smoke.py
T

28 lines
900 B
Python

import os
import unittest
from ollama_nlu import OllamaNLUClient
@unittest.skipUnless(
os.getenv("ROLLCALC_RUN_OLLAMA_SMOKE") == "1",
"set ROLLCALC_RUN_OLLAMA_SMOKE=1 to use the local Ollama model",
)
class RealOllamaSmokeTests(unittest.TestCase):
def test_representative_german_request(self):
response = OllamaNLUClient().interpret(
"Welchen Durchmesser hat Bentofix NSP 4900, "
"Artikelnummer 180205 bei 65 m Länge?"
)
interpretation = response.interpretation
self.assertEqual(interpretation.intent, "new_calculation")
self.assertEqual(interpretation.article_number, "180205")
self.assertEqual(interpretation.article_name_hint, "Bentofix NSP 4900")
self.assertEqual(interpretation.roll_length_m, 65.0)
self.assertIsNone(interpretation.width_m)
if __name__ == "__main__":
unittest.main()