From 392725c12bcbff0bf01974c78534f89846dfd89b Mon Sep 17 00:00:00 2001 From: Miel Vander Sande Date: Tue, 12 May 2026 21:16:50 +0200 Subject: [PATCH] Add testcase for compactArrays --- tests/test_jsonld.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tests/test_jsonld.py b/tests/test_jsonld.py index 6f9699d6..7b4eb953 100644 --- a/tests/test_jsonld.py +++ b/tests/test_jsonld.py @@ -931,3 +931,19 @@ def test_empty_context(self): input = {'http://schema.org/codeRepository': {'@id': 'http:'}} compacted = jsonld.compact(input, {}) assert compacted == input + + # Issue 61 + def test_compact_arrays(self): + """ + Compacting with an empty context should return the input unchanged. + """ + input = { + "key1": "abc", + "key2": ["abc", "def"] + } + expected = { + "key1": "abc", + "key2": ["abc", "def"] + } + compacted = jsonld.compact(input, {}, {"compactArrays": True}) + assert compacted == expected