summaryrefslogtreecommitdiffstats
path: root/etc/unittest/main.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-29 20:13:54 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-01-29 20:13:54 +0100
commit770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0 (patch)
treecabcbf5fa9a5dbf75a223377dbf032cfeb3e1027 /etc/unittest/main.py
parentAdd aiohttp_socks to requirements (diff)
downloadgpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar.gz
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar.bz2
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar.lz
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar.xz
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.tar.zst
gpt4free-770bdc54fc52a71ff56ec0e7f1a38adba01f0ae0.zip
Diffstat (limited to '')
-rw-r--r--etc/unittest/main.py13
1 files changed, 10 insertions, 3 deletions
diff --git a/etc/unittest/main.py b/etc/unittest/main.py
index f5eb5138..cc3c6a18 100644
--- a/etc/unittest/main.py
+++ b/etc/unittest/main.py
@@ -24,12 +24,19 @@ class TestGetLastProvider(unittest.TestCase):
def test_get_last_provider(self):
ChatCompletion.create(g4f.models.default, DEFAULT_MESSAGES, ProviderMock)
self.assertEqual(get_last_provider(), ProviderMock)
-
+
def test_get_last_provider_retry(self):
ChatCompletion.create(g4f.models.default, DEFAULT_MESSAGES, RetryProvider([ProviderMock]))
self.assertEqual(get_last_provider(), ProviderMock)
-
+
def test_get_last_provider_async(self):
coroutine = ChatCompletion.create_async(g4f.models.default, DEFAULT_MESSAGES, ProviderMock)
asyncio.run(coroutine)
- self.assertEqual(get_last_provider(), ProviderMock) \ No newline at end of file
+ self.assertEqual(get_last_provider(), ProviderMock)
+
+ def test_get_last_provider_as_dict(self):
+ ChatCompletion.create(g4f.models.default, DEFAULT_MESSAGES, ProviderMock)
+ last_provider_dict = get_last_provider(True)
+ self.assertIsInstance(last_provider_dict, dict)
+ self.assertIn('name', last_provider_dict)
+ self.assertEqual(ProviderMock.__name__, last_provider_dict['name']) \ No newline at end of file