Skip to content

test(py): add unit tests for wrap_gemini wrapper function#2822

Open
saikiranAnnam wants to merge 2 commits into
langchain-ai:mainfrom
saikiranAnnam:test/py-wrap-gemini-unit-tests
Open

test(py): add unit tests for wrap_gemini wrapper function#2822
saikiranAnnam wants to merge 2 commits into
langchain-ai:mainfrom
saikiranAnnam:test/py-wrap-gemini-unit-tests

Conversation

@saikiranAnnam
Copy link
Copy Markdown

Closes #2818

Problem

wrap_gemini was introduced in langsmith 0.4.33 but didn’t have direct unit tests covering the public wrapper, only the internal processing helpers (_process_gemini_inputs, _create_usage_metadata, etc.) were tested.

This meant the public import path and wrapping behavior weren’t protected against regressions.

Changes

Adds python/tests/unit_tests/wrappers/test_wrap_gemini.py with 9 unit tests:

Test What it guards
test_importable_from_langsmith_wrappers langsmith.wrappers.wrap_gemini is accessible (the exact AttributeError from #2818)
test_importable_directly from langsmith.wrappers import wrap_gemini works
test_in_wrappers_all wrap_gemini stays in __all__ across refactors
test_wraps_sync_generate_content models.generate_content is replaced and __wrapped__ is set
test_wraps_sync_generate_content_stream Same for the streaming method
test_wraps_async_generate_content aio.models.generate_content is replaced and __wrapped__ is set
test_double_wrap_raises ValueError is raised on a second wrap_gemini call
test_partial_client_does_not_crash Clients missing aio or stream methods don't raise
test_beta_warning_emitted LangSmithBetaWarning is emitted (beta API contract)

No source changes — tests only. Mock clients require no google-genai package installed.

This adds regression protection for the public API surface.

Testing

cd python
make format
make lint
make tests

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue: AttributeError: module 'langsmith.wrappers' has no attribute 'wrap_gemini'

1 participant