feat: Enhance text normalization with support for internet slang expansion, currency formatting, and date handling; update debug WAVs interface and settings

This commit is contained in:
JB
2025-12-15 17:27:08 -08:00
parent 0afaaf561b
commit 015435adb6
10 changed files with 472 additions and 74 deletions
+28 -2
View File
@@ -1,9 +1,13 @@
import importlib
import sys
import os
import pytest
# Ensure real optional dependencies are imported before tests that install stubs
# so that available packages (like ebooklib, bs4) aren't replaced with dummy modules.
for module_name in ("ebooklib", "bs4"):
# so that available packages (like ebooklib, bs4, numpy) aren't replaced with dummy modules.
for module_name in ("ebooklib", "bs4", "numpy"):
if module_name not in sys.modules:
try:
importlib.import_module(module_name)
@@ -11,3 +15,25 @@ for module_name in ("ebooklib", "bs4"):
# On environments without the optional dependency, downstream tests
# will install lightweight stubs as needed.
pass
@pytest.fixture(autouse=True, scope="session")
def _isolate_settings_dir(tmp_path_factory: pytest.TempPathFactory):
settings_dir = tmp_path_factory.mktemp("abogen-settings")
os.environ["ABOGEN_SETTINGS_DIR"] = str(settings_dir)
try:
from abogen.utils import get_user_settings_dir
get_user_settings_dir.cache_clear()
except Exception:
pass
try:
from abogen.normalization_settings import clear_cached_settings
clear_cached_settings()
except Exception:
pass
yield