Skip to content

Commit bf0b94e

Browse files
committed
✅ add test for non-comma generator handling with comma_compact_nulls option
1 parent 99f2e88 commit bf0b94e

1 file changed

Lines changed: 25 additions & 0 deletions

File tree

tests/unit/encode_test.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1906,3 +1906,28 @@ def test_comma_compact_nulls_preserves_round_trip_marker(self) -> None:
19061906
comma_compact_nulls=True,
19071907
)
19081908
assert encode({"a": [None, "foo"]}, options) == "a[]=foo"
1909+
1910+
def test_comma_round_trip_branch_for_non_comma_generator(self) -> None:
1911+
tokens = _encode(
1912+
value=[1],
1913+
is_undefined=False,
1914+
side_channel=WeakKeyDictionary(),
1915+
prefix="root",
1916+
comma_round_trip=True,
1917+
comma_compact_nulls=False,
1918+
encoder=EncodeUtils.encode,
1919+
serialize_date=EncodeUtils.serialize_date,
1920+
sort=None,
1921+
filter=None,
1922+
formatter=Format.RFC3986.formatter,
1923+
format=Format.RFC3986,
1924+
generate_array_prefix=ListFormat.INDICES.generator,
1925+
allow_empty_lists=False,
1926+
strict_null_handling=False,
1927+
skip_nulls=False,
1928+
encode_dot_in_keys=False,
1929+
allow_dots=False,
1930+
encode_values_only=False,
1931+
charset=Charset.UTF8,
1932+
)
1933+
assert tokens == ["root%5B%5D%5B0%5D=1"]

0 commit comments

Comments
 (0)