Remove log_transcript config and enforce JSON AI output
This commit is contained in:
parent
c3503fbbde
commit
1423e44008
8 changed files with 198 additions and 62 deletions
|
|
@ -26,7 +26,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cpu")
|
||||
self.assertEqual(cfg.injection.backend, "clipboard")
|
||||
self.assertTrue(cfg.ai.enabled)
|
||||
self.assertFalse(cfg.logging.log_transcript)
|
||||
self.assertEqual(cfg.vocabulary.replacements, [])
|
||||
self.assertEqual(cfg.vocabulary.terms, [])
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 500)
|
||||
|
|
@ -41,7 +40,6 @@ class ConfigTests(unittest.TestCase):
|
|||
"stt": {"model": "small", "device": "cuda"},
|
||||
"injection": {"backend": "injection"},
|
||||
"ai": {"enabled": False},
|
||||
"logging": {"log_transcript": True},
|
||||
"vocabulary": {
|
||||
"replacements": [
|
||||
{"from": "Martha", "to": "Marta"},
|
||||
|
|
@ -65,7 +63,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cuda")
|
||||
self.assertEqual(cfg.injection.backend, "injection")
|
||||
self.assertFalse(cfg.ai.enabled)
|
||||
self.assertTrue(cfg.logging.log_transcript)
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 100)
|
||||
self.assertEqual(cfg.vocabulary.max_terms, 200)
|
||||
self.assertEqual(len(cfg.vocabulary.replacements), 2)
|
||||
|
|
@ -83,7 +80,6 @@ class ConfigTests(unittest.TestCase):
|
|||
"whisper_device": "cpu",
|
||||
"injection_backend": "clipboard",
|
||||
"ai_enabled": False,
|
||||
"log_transcript": True,
|
||||
}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
|
|
@ -97,7 +93,6 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cpu")
|
||||
self.assertEqual(cfg.injection.backend, "clipboard")
|
||||
self.assertFalse(cfg.ai.enabled)
|
||||
self.assertTrue(cfg.logging.log_transcript)
|
||||
self.assertEqual(cfg.vocabulary.replacements, [])
|
||||
|
||||
def test_invalid_injection_backend_raises(self):
|
||||
|
|
@ -109,13 +104,22 @@ class ConfigTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(ValueError, "injection.backend"):
|
||||
load(str(path))
|
||||
|
||||
def test_invalid_logging_flag_raises(self):
|
||||
payload = {"logging": {"log_transcript": "yes"}}
|
||||
def test_removed_logging_section_raises(self):
|
||||
payload = {"logging": {"log_transcript": True}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "logging.log_transcript"):
|
||||
with self.assertRaisesRegex(ValueError, "no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_legacy_log_transcript_raises(self):
|
||||
payload = {"log_transcript": True}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_conflicting_replacements_raise(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue