Spaces:
Running
Running
""" | |
Tests for the config module. | |
""" | |
import unittest | |
import os | |
from unittest.mock import patch | |
# Import the module to test | |
import config | |
class TestConfig(unittest.TestCase): | |
"""Test cases for the config module.""" | |
def test_get_chatbot_config(self): | |
"""Test that get_chatbot_config returns expected values.""" | |
# Call the function | |
result = config.get_chatbot_config() | |
# Check the result | |
self.assertIsInstance(result, dict) | |
self.assertIn('model', result) | |
self.assertIn('temperature', result) | |
self.assertIn('max_tokens', result) | |
self.assertIn('embedding_model', result) | |
def test_environment_override(self): | |
"""Test that environment variables override defaults.""" | |
# Force reload of the config module | |
import importlib | |
importlib.reload(config) | |
# Check that the environment variable was used | |
self.assertEqual(config.LLM_MODEL, "test-model") | |
# Check that the config dict contains the override | |
result = config.get_chatbot_config() | |
self.assertEqual(result['model'], "test-model") | |
if __name__ == '__main__': | |
unittest.main() |