MCPcopy Index your code
hub / github.com/google/adk-python / test_list_versions

Function test_list_versions

tests/unittests/artifacts/test_artifact_service.py:357–389  ·  view source on GitHub ↗

Tests listing versions of an artifact.

(service_type, artifact_service_factory)

Source from the content-addressed store, hash-verified

355 ],
356)
357async def test_list_versions(service_type, artifact_service_factory):
358 """Tests listing versions of an artifact."""
359 artifact_service = artifact_service_factory(service_type)
360
361 app_name = "app0"
362 user_id = "user0"
363 session_id = "123"
364 filename = "with/slash/filename"
365 versions = [
366 types.Part.from_bytes(
367 data=i.to_bytes(2, byteorder="big"), mime_type="text/plain"
368 )
369 for i in range(3)
370 ]
371 versions.append(types.Part.from_text(text="hello"))
372
373 for i in range(4):
374 await artifact_service.save_artifact(
375 app_name=app_name,
376 user_id=user_id,
377 session_id=session_id,
378 filename=filename,
379 artifact=versions[i],
380 )
381
382 response_versions = await artifact_service.list_versions(
383 app_name=app_name,
384 user_id=user_id,
385 session_id=session_id,
386 filename=filename,
387 )
388
389 assert response_versions == list(range(4))
390
391
392@pytest.mark.asyncio

Callers

nothing calls this directly

Calls 4

artifact_service_factoryFunction · 0.85
appendMethod · 0.45
save_artifactMethod · 0.45
list_versionsMethod · 0.45

Tested by

no test coverage detected