Skip to content

Commit 33ee705

Browse files
committed
Fix tests and add tests for append, last_chunk flags
1 parent 9161159 commit 33ee705

File tree

2 files changed

+32
-1
lines changed

2 files changed

+32
-1
lines changed

tests/server/tasks/test_task_updater.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,6 +146,37 @@ async def test_add_artifact_generates_id(
146146
assert isinstance(event, TaskArtifactUpdateEvent)
147147
assert event.artifact.artifactId == str(known_uuid)
148148
assert event.artifact.parts == sample_parts
149+
assert event.append == None
150+
assert event.lastChunk == None
151+
152+
153+
154+
@pytest.mark.asyncio
155+
@pytest.mark.parametrize(
156+
"append_val, last_chunk_val",
157+
[
158+
(False, False),
159+
(True, True),
160+
(True, False),
161+
(False, True),
162+
],
163+
)
164+
async def test_add_artifact_with_append_last_chunk(
165+
task_updater, event_queue, sample_parts, append_val, last_chunk_val
166+
):
167+
"""Test add_artifact with append and last_chunk flags."""
168+
await task_updater.add_artifact(
169+
parts=sample_parts, artifact_id="id1", append=append_val, last_chunk=last_chunk_val
170+
)
171+
172+
event_queue.enqueue_event.assert_called_once()
173+
event = event_queue.enqueue_event.call_args[0][0]
174+
175+
assert isinstance(event, TaskArtifactUpdateEvent)
176+
assert event.artifact.artifactId == "id1"
177+
assert event.artifact.parts == sample_parts
178+
assert event.append == append_val
179+
assert event.lastChunk == last_chunk_val
149180

150181

151182
@pytest.mark.asyncio

tests/utils/test_proto_utils.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def test_task_id_params_from_proto_invalid_name(self):
237237
assert isinstance(exc_info.value.error, types.InvalidParamsError)
238238

239239
def test_task_push_config_from_proto_invalid_parent(self):
240-
request = a2a_pb2.CreateTaskPushNotificationRequest(
240+
request = a2a_pb2.CreateTaskPushNotificationConfigRequest(
241241
parent='invalid-parent'
242242
)
243243
with pytest.raises(ServerError) as exc_info:

0 commit comments

Comments
 (0)