Skip to content

Commit 3ffed6b

Browse files
committed
feat(test-utils): add fixtures for debug
- Introduce `actual_debug` fixture to provide a Debug instance for real API interactions in tests. - Add `fake_debug` fixture for testing with mock values.
1 parent faed591 commit 3ffed6b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

tests/conftest.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
from typesense.configuration import Configuration
1616
from typesense.conversation_model import ConversationModel
1717
from typesense.conversations_models import ConversationsModels
18+
from typesense.debug import Debug
1819
from typesense.document import Document
1920
from typesense.documents import Documents
2021
from typesense.key import Key
@@ -408,6 +409,12 @@ def actual_documents_fixture(actual_api_call: ApiCall) -> Documents:
408409
return Documents(actual_api_call, "companies")
409410

410411

412+
@pytest.fixture(scope="function", name="actual_debug")
413+
def actual_debug_fixture(actual_api_call: ApiCall) -> Debug:
414+
"""Return a Debug object using a real API."""
415+
return Debug(actual_api_call)
416+
417+
411418
@pytest.fixture(scope="function", name="actual_multi_search")
412419
def actual_multi_search_fixture(actual_api_call: ApiCall) -> MultiSearch:
413420
"""Return a MultiSearch object using a real API."""
@@ -626,6 +633,12 @@ def fake_document_fixture(fake_api_call: ApiCall) -> Document:
626633
return Document(fake_api_call, "companies", "0")
627634

628635

636+
@pytest.fixture(scope="function", name="fake_debug")
637+
def fake_debug_fixture(fake_api_call: ApiCall) -> Debug:
638+
"""Return a debug object with test values."""
639+
return Debug(fake_api_call)
640+
641+
629642
class Company(typing.TypedDict):
630643
"""Company data type."""
631644

0 commit comments

Comments
 (0)