Remove unused vocabulary and domain mode options
This commit is contained in:
parent
a6e75f9c16
commit
7af8750258
5 changed files with 34 additions and 93 deletions
|
|
@ -28,10 +28,7 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertFalse(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertEqual(cfg.vocabulary.replacements, [])
|
||||
self.assertEqual(cfg.vocabulary.terms, [])
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 500)
|
||||
self.assertEqual(cfg.vocabulary.max_terms, 500)
|
||||
self.assertTrue(cfg.domain_inference.enabled)
|
||||
self.assertEqual(cfg.domain_inference.mode, "auto")
|
||||
|
||||
def test_loads_nested_config(self):
|
||||
payload = {
|
||||
|
|
@ -48,10 +45,8 @@ class ConfigTests(unittest.TestCase):
|
|||
{"from": "docker", "to": "Docker"},
|
||||
],
|
||||
"terms": ["Systemd", "Kubernetes"],
|
||||
"max_rules": 100,
|
||||
"max_terms": 200,
|
||||
},
|
||||
"domain_inference": {"enabled": True, "mode": "auto"},
|
||||
"domain_inference": {"enabled": True},
|
||||
}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
|
|
@ -65,14 +60,11 @@ class ConfigTests(unittest.TestCase):
|
|||
self.assertEqual(cfg.stt.device, "cuda")
|
||||
self.assertEqual(cfg.injection.backend, "injection")
|
||||
self.assertTrue(cfg.injection.remove_transcription_from_clipboard)
|
||||
self.assertEqual(cfg.vocabulary.max_rules, 100)
|
||||
self.assertEqual(cfg.vocabulary.max_terms, 200)
|
||||
self.assertEqual(len(cfg.vocabulary.replacements), 2)
|
||||
self.assertEqual(cfg.vocabulary.replacements[0].source, "Martha")
|
||||
self.assertEqual(cfg.vocabulary.replacements[0].target, "Marta")
|
||||
self.assertEqual(cfg.vocabulary.terms, ["Systemd", "Kubernetes"])
|
||||
self.assertTrue(cfg.domain_inference.enabled)
|
||||
self.assertEqual(cfg.domain_inference.mode, "auto")
|
||||
|
||||
def test_loads_legacy_keys(self):
|
||||
payload = {
|
||||
|
|
@ -200,13 +192,31 @@ class ConfigTests(unittest.TestCase):
|
|||
with self.assertRaisesRegex(ValueError, "wildcard"):
|
||||
load(str(path))
|
||||
|
||||
def test_invalid_domain_mode_raises(self):
|
||||
def test_removed_domain_mode_raises(self):
|
||||
payload = {"domain_inference": {"mode": "heuristic"}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "domain_inference.mode"):
|
||||
with self.assertRaisesRegex(ValueError, "domain_inference.mode is no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_vocabulary_max_rules_raises(self):
|
||||
payload = {"vocabulary": {"max_rules": 100}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "vocabulary.max_rules is no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
def test_removed_vocabulary_max_terms_raises(self):
|
||||
payload = {"vocabulary": {"max_terms": 100}}
|
||||
with tempfile.TemporaryDirectory() as td:
|
||||
path = Path(td) / "config.json"
|
||||
path.write_text(json.dumps(payload), encoding="utf-8")
|
||||
|
||||
with self.assertRaisesRegex(ValueError, "vocabulary.max_terms is no longer supported"):
|
||||
load(str(path))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,7 @@ class VocabularyEngineTests(unittest.TestCase):
|
|||
replacements=replacements or [],
|
||||
terms=terms or [],
|
||||
)
|
||||
domain = DomainInferenceConfig(enabled=domain_enabled, mode="auto")
|
||||
domain = DomainInferenceConfig(enabled=domain_enabled)
|
||||
return VocabularyEngine(vocab, domain)
|
||||
|
||||
def test_boundary_aware_replacement(self):
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue