Skip to content

Commit 4e29c74

Browse files
Update tests/server/tasks/test_id_generator.py
Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent ad6073e commit 4e29c74

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

tests/server/tasks/test_id_generator.py

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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

Comments
 (0)