diff options
author | H Lohaus <hlohaus@users.noreply.github.com> | 2024-01-21 09:37:35 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-01-21 09:37:35 +0100 |
commit | fea4f546a7fb7c7af5a3da2247b5ea966e179f08 (patch) | |
tree | 59266fc31ec6df5fa53ef97b22f024f2f3f339f8 /etc/unittest/mocks.py | |
parent | Merge pull request #1484 from hlohaus/copilot (diff) | |
parent | Update workflow (diff) | |
download | gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar.gz gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar.bz2 gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar.lz gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar.xz gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.tar.zst gpt4free-fea4f546a7fb7c7af5a3da2247b5ea966e179f08.zip |
Diffstat (limited to 'etc/unittest/mocks.py')
-rw-r--r-- | etc/unittest/mocks.py | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/etc/unittest/mocks.py b/etc/unittest/mocks.py new file mode 100644 index 00000000..a9505997 --- /dev/null +++ b/etc/unittest/mocks.py @@ -0,0 +1,25 @@ +from g4f.Provider.base_provider import AbstractProvider, AsyncProvider, AsyncGeneratorProvider + +class ProviderMock(AbstractProvider): + working = True + + def create_completion( + model, messages, stream, **kwargs + ): + yield "Mock" + +class AsyncProviderMock(AsyncProvider): + working = True + + async def create_async( + model, messages, **kwargs + ): + return "Mock" + +class AsyncGeneratorProviderMock(AsyncGeneratorProvider): + working = True + + async def create_async_generator( + model, messages, stream, **kwargs + ): + yield "Mock"
\ No newline at end of file |