mirror of
https://github.com/aljazceru/Auto-GPT.git
synced 2026-02-10 08:44:27 +01:00
Fix(tests): restore config values after changing them in tests (#2904)
This commit is contained in:
committed by
GitHub
parent
0efbe23d89
commit
e39cd1bf57
@@ -38,47 +38,89 @@ class TestConfig(TestCase):
|
||||
"""
|
||||
Test if the set_continuous_mode() method updates the continuous_mode attribute.
|
||||
"""
|
||||
# Store continuous mode to reset it after the test
|
||||
continuous_mode = self.config.continuous_mode
|
||||
|
||||
self.config.set_continuous_mode(True)
|
||||
self.assertTrue(self.config.continuous_mode)
|
||||
|
||||
# Reset continuous mode
|
||||
self.config.set_continuous_mode(continuous_mode)
|
||||
|
||||
def test_set_speak_mode(self):
|
||||
"""
|
||||
Test if the set_speak_mode() method updates the speak_mode attribute.
|
||||
"""
|
||||
# Store speak mode to reset it after the test
|
||||
speak_mode = self.config.speak_mode
|
||||
|
||||
self.config.set_speak_mode(True)
|
||||
self.assertTrue(self.config.speak_mode)
|
||||
|
||||
# Reset speak mode
|
||||
self.config.set_speak_mode(speak_mode)
|
||||
|
||||
def test_set_fast_llm_model(self):
|
||||
"""
|
||||
Test if the set_fast_llm_model() method updates the fast_llm_model attribute.
|
||||
"""
|
||||
# Store model name to reset it after the test
|
||||
fast_llm_model = self.config.fast_llm_model
|
||||
|
||||
self.config.set_fast_llm_model("gpt-3.5-turbo-test")
|
||||
self.assertEqual(self.config.fast_llm_model, "gpt-3.5-turbo-test")
|
||||
|
||||
# Reset model name
|
||||
self.config.set_fast_llm_model(fast_llm_model)
|
||||
|
||||
def test_set_smart_llm_model(self):
|
||||
"""
|
||||
Test if the set_smart_llm_model() method updates the smart_llm_model attribute.
|
||||
"""
|
||||
# Store model name to reset it after the test
|
||||
smart_llm_model = self.config.smart_llm_model
|
||||
|
||||
self.config.set_smart_llm_model("gpt-4-test")
|
||||
self.assertEqual(self.config.smart_llm_model, "gpt-4-test")
|
||||
|
||||
# Reset model name
|
||||
self.config.set_smart_llm_model(smart_llm_model)
|
||||
|
||||
def test_set_fast_token_limit(self):
|
||||
"""
|
||||
Test if the set_fast_token_limit() method updates the fast_token_limit attribute.
|
||||
"""
|
||||
# Store token limit to reset it after the test
|
||||
fast_token_limit = self.config.fast_token_limit
|
||||
|
||||
self.config.set_fast_token_limit(5000)
|
||||
self.assertEqual(self.config.fast_token_limit, 5000)
|
||||
|
||||
# Reset token limit
|
||||
self.config.set_fast_token_limit(fast_token_limit)
|
||||
|
||||
def test_set_smart_token_limit(self):
|
||||
"""
|
||||
Test if the set_smart_token_limit() method updates the smart_token_limit attribute.
|
||||
"""
|
||||
# Store token limit to reset it after the test
|
||||
smart_token_limit = self.config.smart_token_limit
|
||||
|
||||
self.config.set_smart_token_limit(9000)
|
||||
self.assertEqual(self.config.smart_token_limit, 9000)
|
||||
|
||||
# Reset token limit
|
||||
self.config.set_smart_token_limit(smart_token_limit)
|
||||
|
||||
def test_set_debug_mode(self):
|
||||
"""
|
||||
Test if the set_debug_mode() method updates the debug_mode attribute.
|
||||
"""
|
||||
# Store debug mode to reset it after the test
|
||||
debug_mode = self.config.debug_mode
|
||||
|
||||
self.config.set_debug_mode(True)
|
||||
self.assertTrue(self.config.debug_mode)
|
||||
|
||||
# Reset debug mode
|
||||
self.config.set_debug_mode(debug_mode)
|
||||
|
||||
Reference in New Issue
Block a user