Skip to content

Commit 3fd547c

Browse files
committed
Use deterministic JSON ordering in tests
Signed-off-by: Nic Cope <[email protected]>
1 parent 711fad0 commit 3fd547c

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

tests/test_response.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,8 @@ class TestCase:
6666
for case in cases:
6767
got = response.to(case.req, case.ttl)
6868
self.assertEqual(
69-
json_format.MessageToJson(case.want),
70-
json_format.MessageToJson(got),
69+
json_format.MessageToJson(case.want, sort_keys=True),
70+
json_format.MessageToJson(got, sort_keys=True),
7171
"-want, +got",
7272
)
7373

@@ -185,8 +185,8 @@ class TestCase:
185185
got_selector = case.rsp.requirements.resources[case.name]
186186

187187
self.assertEqual(
188-
json_format.MessageToJson(case.want_selector),
189-
json_format.MessageToJson(got_selector),
188+
json_format.MessageToJson(case.want_selector, sort_keys=True),
189+
json_format.MessageToJson(got_selector, sort_keys=True),
190190
case.reason,
191191
)
192192

0 commit comments

Comments
 (0)