diff --git a/pynamodb/tests/test_attributes.py b/pynamodb/tests/test_attributes.py index 3c6739f86..aa0778b7f 100644 --- a/pynamodb/tests/test_attributes.py +++ b/pynamodb/tests/test_attributes.py @@ -613,11 +613,11 @@ def test_raw_map_json_serialize(self): } } - serialized_raw = json.dumps(raw) - self.assertEqual(json.dumps(AttributeTestModel(map_attr=raw).map_attr.as_dict()), - serialized_raw) - self.assertEqual(json.dumps(AttributeTestModel(map_attr=MapAttribute(**raw)).map_attr.as_dict()), - serialized_raw) + serialized_raw = json.dumps(raw, sort_keys=True) + self.assertEqual(json.dumps(AttributeTestModel(map_attr=raw).map_attr.as_dict(), + sort_keys=True), serialized_raw) + self.assertEqual(json.dumps(AttributeTestModel(map_attr=MapAttribute(**raw)).map_attr.as_dict(), + sort_keys=True), serialized_raw) def test_typed_and_raw_map_json_serialize(self): class TypedMap(MapAttribute):