Skip to content

Commit 7672ff6

Browse files
google-genai-botcopybara-github
authored andcommitted
feat(genai-sdk): Add environments dedicated module and from_environment support
PiperOrigin-RevId: 987264252
1 parent eb754a9 commit 7672ff6

1 file changed

Lines changed: 27 additions & 0 deletions

File tree

‎google/genai/tests/gaos/test_environments_lifecycle.py‎

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
import pytest
2727

2828
from ... import Client
29+
from ... import environments
30+
from ... import interactions
2931
from ..._gaos.google_genai import (
3032
AsyncGeminiNextGenEnvironmentFiles,
3133
GeminiNextGenEnvironmentFiles,
@@ -706,3 +708,28 @@ def test_python_environments_types_and_models():
706708
from_environment="environments/env_abc_1234",
707709
)
708710
assert create_req.from_environment == "environments/env_abc_1234"
711+
712+
713+
def test_python_environments_dedicated_module_and_from_environment():
714+
"""Tests dedicated environments module and from_environment creation."""
715+
assert hasattr(environments, "CreateEnvironmentRequest")
716+
assert hasattr(environments, "Environment")
717+
assert hasattr(environments, "EnvironmentListResponse")
718+
assert hasattr(environments, "EnvironmentFile")
719+
assert hasattr(environments, "GetEnvironmentFilesResponse")
720+
assert hasattr(environments, "EnvironmentStatus")
721+
assert hasattr(environments, "EnvironmentListParams")
722+
assert hasattr(environments, "EnvironmentDeleteResponse")
723+
724+
# Test backward-compatible re-exports in interactions module
725+
assert hasattr(interactions, "Environment")
726+
assert hasattr(interactions, "CreateEnvironmentRequest")
727+
assert hasattr(interactions, "EnvironmentFile")
728+
729+
req = environments.CreateEnvironmentRequest(
730+
from_environment="environments/env_abc_1234",
731+
)
732+
assert req.from_environment == "environments/env_abc_1234"
733+
734+
req_dict = req.model_dump(exclude_unset=True, by_alias=True)
735+
assert req_dict == {"from_environment": "environments/env_abc_1234"}

0 commit comments

Comments
 (0)