Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions google/genai/tests/afc/test_generate_content_stream_afc.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
from ... import types


pytestmark = [
pytest.mark.skipif(
"config.getoption('--private')",
reason="AFC logic in private SDK is re-written",
),
]


TEST_NO_AFC_PART = types.Part(
text=(
'Okay, here is the weather in San Francisco'
Expand Down
8 changes: 8 additions & 0 deletions google/genai/tests/afc/test_should_disable_afc.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,17 @@
"""Tests for should_disable_afc."""

import pytest
from .. import pytest_helper
from ... import types
from ..._extra_utils import should_disable_afc

pytestmark = [
pytest.mark.skipif(
"config.getoption('--private')",
reason="AFC re-written for private SDK",
),
]


def test_config_is_none():
assert should_disable_afc(None) is False
Expand Down
4 changes: 4 additions & 0 deletions google/genai/tests/chats/test_get_history.py
Original file line number Diff line number Diff line change
Expand Up @@ -562,6 +562,10 @@ def test_chat_stream_with_empty_content(
assert not chat.get_history(curated=True)


@pytest.mark.skipif(
'config.getoption("--private")',
reason='AFC logic in private is re-written',
)
def test_chat_with_afc_history(mock_generate_content_afc_history):
models_module = models.Models(mock_api_client)
chats_module = chats.Chats(modules=models_module)
Expand Down
14 changes: 10 additions & 4 deletions google/genai/tests/chats/test_send_message.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,16 @@
raise e


pytestmark = pytest_helper.setup(
file=__file__,
globals_for_file=globals(),
)
pytestmark = [
pytest_helper.setup(
file=__file__,
globals_for_file=globals(),
),
pytest.mark.skipif(
"config.getoption('--private')",
reason="AFC re-written for private SDK",
),
]
pytest_plugins = ('pytest_asyncio',)


Expand Down
4 changes: 3 additions & 1 deletion google/genai/tests/chats/test_validate_response.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,10 @@
#


from ... import chats
from ... import types
from ...chats import _validate_response

_validate_response = chats._validate_response


def test_validate_response_default_response():
Expand Down
9 changes: 9 additions & 0 deletions google/genai/tests/models/test_function_call_streaming.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,11 @@
test_method='models.generate_content_stream',
)


@pytest.mark.skipif(
'config.getoption("--private")',
reason='in private it was not able to find the replay file',
)
def test_streaming_with_python_native_no_afc_config(client):
"""Tests streaming function calls with native python AFC without disabling AFC."""
if not client.vertexai:
Expand All @@ -173,6 +178,10 @@ def test_streaming_with_python_native_no_afc_config(client):
assert 'not compatible with automatic function calling (AFC)' in str(e.value)


@pytest.mark.skipif(
'config.getoption("--private")',
reason='in private it was not able to find the replay file',
)
def test_streaming_with_python_afc_disabled_false(client):
"""Tests streaming function calls with native python AFC without disabling AFC."""
if not client.vertexai:
Expand Down
4 changes: 4 additions & 0 deletions google/genai/tests/models/test_generate_content.py
Original file line number Diff line number Diff line change
Expand Up @@ -2159,6 +2159,10 @@ class Foo(BaseModel):
)


@pytest.mark.skipif(
'config.getoption("--private")',
reason='AFC removed from private models.py',
)
def test_function(client):
def get_weather(city: str) -> str:
"""Returns the weather in a city."""
Expand Down
4 changes: 4 additions & 0 deletions google/genai/tests/models/test_generate_content_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,10 @@ async def test_mcp_tools_with_custom_headers_async(client):
}


@pytest.mark.skipif(
'config.getoption("--private")',
reason='AFC by default is disabled in private models.py',
)
@pytest.mark.asyncio
async def test_mcp_tools_subsequent_calls_async(client):
class MockMcpClientSession(McpClientSession):
Expand Down
Loading
Loading