From 7a2648dfe150f532d1690fa8fbaf588789afaa84 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 16 Mar 2023 13:17:47 +0000 Subject: Handle null bytes in object keys --- tests/jq_tests.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'tests') diff --git a/tests/jq_tests.py b/tests/jq_tests.py index e5b0b5e..5b8e630 100644 --- a/tests/jq_tests.py +++ b/tests/jq_tests.py @@ -308,6 +308,13 @@ class TestJvToPython(object): assert_equal({"a": {}, "b": {}}, program.input(text='{"a": {}, "b": {}}').first()) assert_equal({"": {"": {}}}, program.input(text='{"": {"": {}}}').first()) + def test_object_keys_containing_null_characters_are_preserved(self): + program = jq.compile(".") + + result = program.input({"a\x00b": None}).first() + + assert_equal({"a\x00b": None}, result) + class TestConvenienceFunctions(object): def test_first_function_with_json_value_input_returns_first_output_element(self): -- cgit v1.2.3