Skip to content

Commit 52ae4f1

Browse files
authored
Fix test_order_frozendict (#1107)
Refs #1052 (review)
1 parent 0934a74 commit 52ae4f1

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

‎tests/unit/test_common.py‎

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5042,15 +5042,18 @@ def test_order_dict_unsortable(self, proto):
50425042
@pytest.mark.parametrize("use_encoder", [False, True])
50435043
def test_order_frozendict(self, msg, order, use_encoder, proto):
50445044
if use_encoder:
5045-
res = proto.Encoder(order=order).encode(msg)
5045+
res = proto.Encoder(order=order).encode(frozendict(msg))
50465046
else:
5047-
res = proto.encode(msg, order=order)
5047+
res = proto.encode(frozendict(msg), order=order)
50485048

5049+
# `frozendict` must be equal to the regular `dict`:
5050+
assert isinstance(msg, dict)
50495051
if order is not None:
5050-
sol = proto.encode(frozendict(sorted(msg.items())))
5052+
sol = proto.encode(dict(sorted(msg.items())))
50515053
else:
50525054
sol = proto.encode(msg)
50535055

5056+
assert isinstance(res, bytes)
50545057
assert res == sol
50555058

50565059
@py315_or_later_only

0 commit comments

Comments
 (0)