@@ -28,14 +28,20 @@ def test_context_creation_with_defaults(self):
2828 assert context .task_id is None
2929 assert context .context_id is None
3030
31- def test_context_creation_with_partial_fields (self ):
31+ @pytest .mark .parametrize (
32+ 'kwargs, expected_task_id, expected_context_id' ,
33+ [
34+ ({'task_id' : 'task_123' }, 'task_123' , None ),
35+ ({'context_id' : 'context_456' }, None , 'context_456' ),
36+ ],
37+ )
38+ def test_context_creation_with_partial_fields (
39+ self , kwargs , expected_task_id , expected_context_id
40+ ):
3241 """Test creating context with only some fields populated."""
33- context = IDGeneratorContext (task_id = 'task_123' )
34- assert context .task_id == 'task_123'
35- assert context .context_id is None
36- context = IDGeneratorContext (context_id = 'context_456' )
37- assert context .task_id is None
38- assert context .context_id == 'context_456'
42+ context = IDGeneratorContext (** kwargs )
43+ assert context .task_id == expected_task_id
44+ assert context .context_id == expected_context_id
3945
4046 def test_context_mutability (self ):
4147 """Test that context fields can be updated (Pydantic models are mutable by default)."""
0 commit comments