test(parser): add unit tests for payload_fixer module#1468
test(parser): add unit tests for payload_fixer module#1468vishnuprakaz wants to merge 4 commits into
Conversation
There was a problem hiding this comment.
Code Review
This pull request introduces a new test suite for the parse_and_fix utility, covering JSON normalization, trailing comma autofixes, and error handling. The review feedback highlights opportunities to improve test coverage by including single smart quotes and primitive JSON types (e.g., booleans, nulls) as invalid payloads. The reviewer also pointed out several redundant test cases that could be removed to reduce code duplication and improve clarity.
8669aa3 to
ef42fbe
Compare
|
/cc @nan-yu do you mind taking a look at these tests? |
|
We have migrated unit tests into conformance tests so that it can be shared across multiple SDK languages: https://github.com/google/A2UI/blob/main/agent_sdks/conformance/suites/parser.yaml#L83. Are there any missing test cases? If so, we should add them to the conformance test spec. |
|
Thanks @nan-yu! Looking at suites/parser.yaml, the basic fix_payload cases are already covered. A few scenarios from this PR aren't in the YAML yet nested trailing commas, multiple messages, and additional invalid payload shapes. Should I add those to parser.yaml and close this PR? |
You can go either way, either opening a new PR or repurposing this PR with new conformance tests in parser.yaml. |
Description
Add unit tests for the
payload_fixermodule in the Python agent SDK.The
parse_and_fixfunction had no dedicated unit tests — it was onlyexercised indirectly via conformance tests. This PR adds direct coverage
for all behaviors in the module.
Are these changes tested?
Yes — 20 tests covering:
ValueErrorwith the correct messageTesting/Running Instructions
cd agent_sdks/pythonuv run pytest tests/parser/test_payload_fixer.py -vPre-launch Checklist