diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-02-14 09:22:32 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-14 09:22:32 +0100 |
commit | 51686409f86e187d9c13cbea9388f31f567a118c (patch) | |
tree | c4291ff5375b77d70622cfa25490f5a02a5ee970 /etc/unittest/mocks.py | |
parent | Update client.md (diff) | |
parent | Add unitests for the client (diff) | |
download | gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.gz gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.bz2 gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.lz gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.xz gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.tar.zst gpt4free-51686409f86e187d9c13cbea9388f31f567a118c.zip |
Diffstat (limited to 'etc/unittest/mocks.py')
-rw-r--r-- | etc/unittest/mocks.py | 19 |
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 |