File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -97,6 +97,16 @@ def test_conformance(rel_path, data):
9797 _json_norm (data ["expected" ]), _json_norm (got )
9898 ), f"decode mismatch:\n got: { got } \n exp: { data ['expected' ]} "
9999
100+ elif op == "roundtrip" :
101+ # Encode, verify GCF output matches expected, then decode and verify round-trip.
102+ got = encode_generic (data ["input" ])
103+ if isinstance (data ["expected" ], str ):
104+ assert got == data ["expected" ], f"encode mismatch:\n got: { got !r} \n exp: { data ['expected' ]!r} "
105+ decoded = decode_generic (got )
106+ assert _structural_equal (
107+ _json_norm (data ["input" ]), _json_norm (decoded )
108+ ), f"round-trip mismatch:\n input: { data ['input' ]} \n decoded: { decoded } "
109+
100110 elif op == "error" :
101111 # v3 decoder may surface different error categories for same invalid input.
102112 # The requirement is that it rejects.
You can’t perform that action at this time.
0 commit comments