mirror of
https://github.com/MrSleeps/jellyfin-scene-search.git
synced 2026-11-16 23:11:27 +00:00
Test local caption prompt persistence
This commit is contained in:
+13
-1
@@ -5,7 +5,7 @@ import tempfile
|
||||
import unittest
|
||||
from unittest.mock import Mock
|
||||
|
||||
from scene_search.captioner import OllamaCaptioner
|
||||
from scene_search.captioner import OllamaCaptioner, ensure_caption_prompt_file
|
||||
|
||||
|
||||
class OllamaCaptionerTests(unittest.TestCase):
|
||||
@@ -30,6 +30,18 @@ class OllamaCaptionerTests(unittest.TestCase):
|
||||
self.assertEqual(payload["messages"][0]["role"], "user")
|
||||
self.assertTrue(payload["messages"][0]["images"][0])
|
||||
|
||||
def test_prompt_file_is_created_once_and_remains_editable(self) -> None:
|
||||
with tempfile.TemporaryDirectory() as tmp:
|
||||
prompt_path = Path(tmp) / "caption_prompt.txt"
|
||||
first = ensure_caption_prompt_file(prompt_path)
|
||||
self.assertTrue(prompt_path.is_file())
|
||||
self.assertTrue(first)
|
||||
|
||||
prompt_path.write_text("My test prompt\n", encoding="utf-8")
|
||||
second = ensure_caption_prompt_file(prompt_path)
|
||||
|
||||
self.assertEqual(second, "My test prompt")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
||||
Reference in New Issue
Block a user