From 9cbe9c1ccb2381e37402a36297f11a0f96b1b557 Mon Sep 17 00:00:00 2001 From: Heiner Lohaus Date: Sun, 21 Jan 2024 02:20:23 +0100 Subject: Improve tests --- etc/unittest/mocks.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 etc/unittest/mocks.py (limited to 'etc/unittest/mocks.py') 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 -- cgit v1.2.3