diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-29 20:37:59 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-29 20:37:59 +0100 |
commit | 280ddf57b0f54d1805f1ee26aa699469019e731f (patch) | |
tree | cabcbf5fa9a5dbf75a223377dbf032cfeb3e1027 /etc/unittest/main.py | |
parent | Merge pull request #1523 from u66u/which-webdriver (diff) | |
parent | Improve readme / unittests (diff) | |
download | gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.gz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.bz2 gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.lz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.xz gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.tar.zst gpt4free-280ddf57b0f54d1805f1ee26aa699469019e731f.zip |
Diffstat (limited to 'etc/unittest/main.py')
-rw-r--r-- | etc/unittest/main.py | 13 |
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 |