summaryrefslogtreecommitdiffstats
path: root/etc/unittest
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-23 02:51:10 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-23 02:51:10 +0100
commitd733930a2b1876340039d90f19ece81fab0d078d (patch)
tree208266ba04a3d4d056a85f20c104d324a1b625c8 /etc/unittest
parentUse new client in inter api (diff)
downloadgpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar.gz
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar.bz2
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar.lz
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar.xz
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.tar.zst
gpt4free-d733930a2b1876340039d90f19ece81fab0d078d.zip
Diffstat (limited to '')
-rw-r--r--etc/unittest/client.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/etc/unittest/client.py b/etc/unittest/client.py
index 2bc00c2e..ec8aa4b7 100644
--- a/etc/unittest/client.py
+++ b/etc/unittest/client.py
@@ -35,13 +35,15 @@ class TestPassModel(unittest.TestCase):
response = client.chat.completions.create(messages, "Hello", stream=True)
for chunk in response:
self.assertIsInstance(chunk, ChatCompletionChunk)
- self.assertIsInstance(chunk.choices[0].delta.content, str)
+ if chunk.choices[0].delta.content is not None:
+ self.assertIsInstance(chunk.choices[0].delta.content, str)
messages = [{'role': 'user', 'content': chunk} for chunk in ["You ", "You ", "Other", "?"]]
response = client.chat.completions.create(messages, "Hello", stream=True, max_tokens=2)
response = list(response)
- self.assertEqual(len(response), 2)
+ self.assertEqual(len(response), 3)
for chunk in response:
- self.assertEqual(chunk.choices[0].delta.content, "You ")
+ if chunk.choices[0].delta.content is not None:
+ self.assertEqual(chunk.choices[0].delta.content, "You ")
def test_stop(self):
client = Client(provider=YieldProviderMock)