mirror of
https://github.com/denizsafak/abogen.git
synced 2026-07-18 13:40:27 +02:00
refactor: move VOICES_INTERNAL into KokoroBackend module
Make the Kokoro voice list an internal implementation detail of the
backend instead of a shared constant. The rest of the project already
accesses voices via get_metadata('kokoro').voices.
- Move VOICES_INTERNAL from constants.py to kokoro.py as _VOICES_INTERNAL
- Update tests to use get_metadata('kokoro').voices instead of importing
the constant directly
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
from types import SimpleNamespace
|
||||
from typing import cast
|
||||
|
||||
from abogen.constants import VOICES_INTERNAL
|
||||
from abogen.tts_backend_registry import get_metadata
|
||||
from abogen.webui.conversion_runner import (
|
||||
_chapter_voice_spec,
|
||||
_chunk_voice_spec,
|
||||
@@ -49,4 +49,4 @@ def test_voice_collection_includes_formula_components():
|
||||
voices = _collect_required_voice_ids(job)
|
||||
|
||||
assert {"af_nova", "am_liam"}.issubset(voices)
|
||||
assert voices.issuperset(VOICES_INTERNAL)
|
||||
assert voices.issuperset(get_metadata("kokoro").voices)
|
||||
|
||||
@@ -3,7 +3,7 @@ from typing import cast
|
||||
|
||||
import pytest
|
||||
|
||||
from abogen.constants import VOICES_INTERNAL
|
||||
from abogen.tts_backend_registry import get_metadata
|
||||
from abogen.voice_cache import (
|
||||
LocalEntryNotFoundError,
|
||||
_CACHED_VOICES,
|
||||
@@ -66,4 +66,4 @@ def test_collect_required_voice_ids_includes_all():
|
||||
voices = _collect_required_voice_ids(cast(Job, job))
|
||||
|
||||
assert {"af_nova", "am_liam", "am_michael"}.issubset(voices)
|
||||
assert voices.issuperset(VOICES_INTERNAL)
|
||||
assert voices.issuperset(get_metadata("kokoro").voices)
|
||||
|
||||
Reference in New Issue
Block a user