Fix and expand tests: 63 tests passing, covers all core modules
Remove tests/ from .gitignore (was accidentally excluded). - test_ripper.py: rewrite for current API (_parse_cddb_lines, _extract_tracks, _rename_files, _clean_input); fix default quality - test_organizer.py: update filename assertions (spaces→underscores); add TestSanitizeFilename, TestCheckDiscCounts, in-place mode - test_playlist.py: fix dummy filenames to underscore scheme; add multi-disc, filename sanitization, EXTINF and fallback tests Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
734bc80b79
commit
775f274d02
7 changed files with 637 additions and 1 deletions
37
tests/test_vision_llm.py
Normal file
37
tests/test_vision_llm.py
Normal file
|
|
@ -0,0 +1,37 @@
|
|||
"""Tests für die Vision-LLM JSON-Extraktion."""
|
||||
|
||||
import pytest
|
||||
|
||||
from musiksammlung.vision_llm import _extract_json
|
||||
|
||||
|
||||
def test_extract_pure_json():
|
||||
text = '{"artist": "Test", "album": "Album"}'
|
||||
assert '"Test"' in _extract_json(text)
|
||||
|
||||
|
||||
def test_extract_json_from_markdown_block():
|
||||
text = 'Hier ist das Ergebnis:\n```json\n{"artist": "Test"}\n```\nFertig.'
|
||||
assert '"Test"' in _extract_json(text)
|
||||
|
||||
|
||||
def test_extract_json_with_thinking_tags():
|
||||
text = '<think>Ich denke nach...</think>\n{"artist": "Test", "album": "X"}'
|
||||
result = _extract_json(text)
|
||||
assert '"Test"' in result
|
||||
|
||||
|
||||
def test_extract_json_with_surrounding_text():
|
||||
text = 'Das JSON:\n{"artist": "A", "album": "B"}\nEnde.'
|
||||
result = _extract_json(text)
|
||||
assert '"A"' in result
|
||||
|
||||
|
||||
def test_extract_json_empty_raises():
|
||||
with pytest.raises(ValueError, match="Leere Antwort"):
|
||||
_extract_json("")
|
||||
|
||||
|
||||
def test_extract_json_no_json_raises():
|
||||
with pytest.raises(ValueError, match="Kein JSON"):
|
||||
_extract_json("Hier ist kein JSON, nur Text.")
|
||||
Loading…
Add table
Add a link
Reference in a new issue