Spaces:
Running
Running
| import os | |
| import unittest | |
| from unittest.mock import patch | |
| from attachment_processing import AttachmentProcessingError, AttachmentProcessor | |
| from model_config import DEFAULT_OLLAMA_MODEL | |
| class AttachmentProcessorConfigurationTests(unittest.TestCase): | |
| def test_gemma_4_is_the_default_multimodal_model(self) -> None: | |
| with patch.dict(os.environ, {}, clear=True): | |
| processor = AttachmentProcessor() | |
| self.assertEqual(processor.multimodal_model, DEFAULT_OLLAMA_MODEL) | |
| self.assertEqual(processor.audio_transport, "images") | |
| self.assertEqual(processor.audio_chunk_seconds, 28) | |
| def test_rejects_invalid_audio_transport(self) -> None: | |
| with patch.dict( | |
| os.environ, {"OLLAMA_AUDIO_TRANSPORT": "unsupported"}, clear=True | |
| ): | |
| with self.assertRaises(AttachmentProcessingError): | |
| AttachmentProcessor() | |
| def test_rejects_audio_chunks_longer_than_model_limit(self) -> None: | |
| with patch.dict( | |
| os.environ, {"GEMMA_AUDIO_CHUNK_SECONDS": "31"}, clear=True | |
| ): | |
| with self.assertRaises(AttachmentProcessingError): | |
| AttachmentProcessor() | |
| if __name__ == "__main__": | |
| unittest.main() | |