summaryrefslogtreecommitdiffstats
path: root/etc/unittest/mocks.py
diff options
context:
space:
mode:
authorHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-14 09:21:57 +0100
committerHeiner Lohaus <hlohaus@users.noreply.github.com>2024-02-14 09:21:57 +0100
commite1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c (patch)
treed8f146187920ffc683953a1e4f0c8476867b7ef4 /etc/unittest/mocks.py
parentAdd variant example (diff)
downloadgpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar.gz
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar.bz2
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar.lz
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar.xz
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.tar.zst
gpt4free-e1a0b3ffa2aa6e5a7c068cdc559ca126f3b57b4c.zip
Diffstat (limited to '')
-rw-r--r--etc/unittest/mocks.py19
1 files changed, 14 insertions, 5 deletions
diff --git a/etc/unittest/mocks.py b/etc/unittest/mocks.py
index 885bdaee..8a67aaf7 100644
--- a/etc/unittest/mocks.py
+++ b/etc/unittest/mocks.py
@@ -7,10 +7,10 @@ class ProviderMock(AbstractProvider):
model, messages, stream, **kwargs
):
yield "Mock"
-
+
class AsyncProviderMock(AsyncProvider):
working = True
-
+
async def create_async(
model, messages, **kwargs
):
@@ -18,16 +18,25 @@ class AsyncProviderMock(AsyncProvider):
class AsyncGeneratorProviderMock(AsyncGeneratorProvider):
working = True
-
+
async def create_async_generator(
model, messages, stream, **kwargs
):
yield "Mock"
-
+
class ModelProviderMock(AbstractProvider):
working = True
def create_completion(
model, messages, stream, **kwargs
):
- yield model \ No newline at end of file
+ yield model
+
+class YieldProviderMock(AsyncGeneratorProvider):
+ working = True
+
+ async def create_async_generator(
+ model, messages, stream, **kwargs
+ ):
+ for message in messages:
+ yield message["content"] \ No newline at end of file