File tree Expand file tree Collapse file tree 1 file changed +15
-0
lines changed
tests/unittests/a2a/converters Expand file tree Collapse file tree 1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change 1414
1515from unittest .mock import Mock
1616from unittest .mock import patch
17+ import uuid
1718
1819from a2a .types import DataPart
1920from a2a .types import Message
@@ -177,6 +178,20 @@ def test_get_context_metadata_none_context(self):
177178 _get_context_metadata (self .mock_event , None )
178179 assert "Invocation context cannot be None" in str (exc_info .value )
179180
181+ def test_event_new_id_uses_uuid4 (self ):
182+ """Event IDs must be collision-safe random UUID4 values."""
183+ event_id = Event .new_id ()
184+ parsed = uuid .UUID (event_id )
185+
186+ assert parsed .version == 4
187+
188+ def test_event_ids_are_unique_for_same_author (self ):
189+ """Events from the same author should not reuse normalized-name IDs."""
190+ events = [Event (author = "same_author" ) for _ in range (64 )]
191+ ids = {event .id for event in events }
192+
193+ assert len (ids ) == len (events )
194+
180195 def test_create_artifact_id (self ):
181196 """Test artifact ID creation."""
182197 app_name = "test-app"
You can’t perform that action at this time.
0 commit comments