Mercurial
comparison dictation/config_test.py @ 282:6bd4a3990696 default tip
Add cross-platform canvas orchestration and typed composer
Enable native ARM dependencies, macOS Copilot orchestration, portable service supervision, CPU dictation, and a shared N-key speak-or-type composer.
Co-authored-by: Copilot <[email protected]>
Copilot-Session: f68442b1-fa8f-46a0-9689-81710613bbd4
| author | MrJuneJune <me@mrjunejune.com> |
|---|---|
| date | Thu, 20 Aug 2026 20:45:25 -0700 |
| parents | 49e9e591c9bb |
| children |
comparison
equal
deleted
inserted
replaced
| 281:c57149ad216e | 282:6bd4a3990696 |
|---|---|
| 11 with patch.dict(os.environ, {}, clear=True): | 11 with patch.dict(os.environ, {}, clear=True): |
| 12 config = DictationConfig.from_environment() | 12 config = DictationConfig.from_environment() |
| 13 self.assertEqual(config.host, "127.0.0.1") | 13 self.assertEqual(config.host, "127.0.0.1") |
| 14 self.assertEqual(config.port, 8090) | 14 self.assertEqual(config.port, 8090) |
| 15 self.assertEqual(config.max_sessions, 1) | 15 self.assertEqual(config.max_sessions, 1) |
| 16 self.assertEqual(config.compute_type, "int8_float16") | 16 self.assertIn(config.device, {"cpu", "cuda"}) |
| 17 self.assertEqual( | |
| 18 config.compute_type, | |
| 19 "int8" if config.device == "cpu" else "int8_float16", | |
| 20 ) | |
| 17 self.assertEqual(config.partial_interval_ms, 500) | 21 self.assertEqual(config.partial_interval_ms, 500) |
| 18 self.assertEqual(config.silence_ms, 400) | 22 self.assertEqual(config.silence_ms, 400) |
| 19 self.assertTrue(str(config.model_dir).endswith("faster-whisper-small")) | 23 self.assertTrue(str(config.model_dir).endswith("faster-whisper-small")) |
| 20 | 24 |
| 21 def test_rejects_invalid_session_limit(self): | 25 def test_rejects_invalid_session_limit(self): |
| 34 clear=True, | 38 clear=True, |
| 35 ): | 39 ): |
| 36 config = DictationConfig.from_environment() | 40 config = DictationConfig.from_environment() |
| 37 self.assertEqual(config.model_dir, Path("/tmp/dictation-model")) | 41 self.assertEqual(config.model_dir, Path("/tmp/dictation-model")) |
| 38 | 42 |
| 43 def test_cpu_defaults_to_int8(self): | |
| 44 with patch.dict( | |
| 45 os.environ, | |
| 46 {"DICTATION_DEVICE": "cpu"}, | |
| 47 clear=True, | |
| 48 ): | |
| 49 config = DictationConfig.from_environment() | |
| 50 self.assertEqual(config.device, "cpu") | |
| 51 self.assertEqual(config.compute_type, "int8") | |
| 52 | |
| 39 | 53 |
| 40 if __name__ == "__main__": | 54 if __name__ == "__main__": |
| 41 unittest.main() | 55 unittest.main() |