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
24 changes: 24 additions & 0 deletions google/genai/_replay_api_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -541,6 +541,30 @@ def _verify_response(self, response_model: BaseModel) -> None:
raw_body = json.dumps(raw_body)
expected['sdk_http_response']['body'] = raw_body
if not self._private:
if actual != expected:
def deep_diff(d1: Any, d2: Any, path: str = '') -> None:
if type(d1) != type(d2):
_debug_print(f"DIFF: Type mismatch at {path}: {type(d1)} != {type(d2)}")
return
if isinstance(d1, dict):
for k in set(d1.keys()).union(d2.keys()):
if k not in d1:
_debug_print(f"DIFF: Key {k} missing from Actual at {path}")
elif k not in d2:
_debug_print(f"DIFF: Key {k} missing from Expected at {path}")
else:
deep_diff(d1[k], d2[k], f"{path}.{k}" if path else k)
elif isinstance(d1, list):
if len(d1) != len(d2):
_debug_print(f"DIFF: List length mismatch at {path}: {len(d1)} != {len(d2)}")
for i in range(min(len(d1), len(d2))):
deep_diff(d1[i], d2[i], f"{path}[{i}]")
else:
if d1 != d2:
_debug_print(f"DIFF: Value mismatch at {path}: {repr(d1)} != {repr(d2)}")
_debug_print("--- START DEEP DIFF ---")
deep_diff(actual, expected)
_debug_print("--- END DEEP DIFF ---")
assert (
actual == expected
), f'SDK response mismatch:\nActual: {actual}\nExpected: {expected}'
Expand Down
5 changes: 5 additions & 0 deletions google/genai/tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,11 @@ def use_vertex():
return False


@pytest.fixture
def model_name(client) -> str:
return 'gemini-2.5-flash' if client._api_client.vertexai else 'gemini-3.5-flash'


# Overridden at the module level for each test file.
@pytest.fixture
def replays_prefix():
Expand Down
Loading
Loading