test: Add tests for config file
parent
d0ae72e63b
commit
28cf7c3f83
|
@ -0,0 +1,58 @@
|
|||
import unittest
|
||||
from scripts.config import Config
|
||||
|
||||
class TestConfig(unittest.TestCase):
|
||||
|
||||
def test_singleton(self):
|
||||
config1 = Config()
|
||||
config2 = Config()
|
||||
self.assertIs(config1, config2)
|
||||
|
||||
def test_initial_values(self):
|
||||
config = Config()
|
||||
self.assertFalse(config.debug_mode)
|
||||
self.assertFalse(config.continuous_mode)
|
||||
self.assertFalse(config.speak_mode)
|
||||
self.assertEqual(config.fast_llm_model, "gpt-3.5-turbo")
|
||||
self.assertEqual(config.smart_llm_model, "gpt-4")
|
||||
self.assertEqual(config.fast_token_limit, 4000)
|
||||
self.assertEqual(config.smart_token_limit, 8000)
|
||||
|
||||
def test_set_continuous_mode(self):
|
||||
config = Config()
|
||||
config.set_continuous_mode(True)
|
||||
self.assertTrue(config.continuous_mode)
|
||||
|
||||
def test_set_speak_mode(self):
|
||||
config = Config()
|
||||
config.set_speak_mode(True)
|
||||
self.assertTrue(config.speak_mode)
|
||||
|
||||
def test_set_fast_llm_model(self):
|
||||
config = Config()
|
||||
config.set_fast_llm_model("gpt-3.5-turbo-test")
|
||||
self.assertEqual(config.fast_llm_model, "gpt-3.5-turbo-test")
|
||||
|
||||
def test_set_smart_llm_model(self):
|
||||
config = Config()
|
||||
config.set_smart_llm_model("gpt-4-test")
|
||||
self.assertEqual(config.smart_llm_model, "gpt-4-test")
|
||||
|
||||
def test_set_fast_token_limit(self):
|
||||
config = Config()
|
||||
config.set_fast_token_limit(5000)
|
||||
self.assertEqual(config.fast_token_limit, 5000)
|
||||
|
||||
def test_set_smart_token_limit(self):
|
||||
config = Config()
|
||||
config.set_smart_token_limit(9000)
|
||||
self.assertEqual(config.smart_token_limit, 9000)
|
||||
|
||||
def test_set_debug_mode(self):
|
||||
config = Config()
|
||||
config.set_debug_mode(True)
|
||||
self.assertTrue(config.debug_mode)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
unittest.main()
|
Loading…
Reference in New Issue