Пример #1
0
 def test_dumps_and_loads_dict(self):
     d = {'a': [1, 2, ('1', 2)], 'b': {'b': 1, 'c': [1, 2]}}
     assert MsgPackSerializer.loads(MsgPackSerializer.dumps(d)) == {
         'a': [1, 2, ['1', 2]],
         'b': {
             'b': 1,
             'c': [1, 2]
         }
     }
Пример #2
0
 def test_dumps_and_loads_dict(self):
     serializer = MsgPackSerializer()
     d = {"a": [1, 2, ("1", 2)], "b": {"b": 1, "c": [1, 2]}}
     assert serializer.loads(serializer.dumps(d)) == {
         "a": [1, 2, ["1", 2]],
         "b": {
             "b": 1,
             "c": [1, 2]
         },
     }
Пример #3
0
 def test_dumps_and_loads_tuple(self):
     serializer = MsgPackSerializer()
     assert serializer.loads(serializer.dumps(Dummy(1, 2))) == [1, 2]
Пример #4
0
 def test_set_types(self, obj):
     serializer = MsgPackSerializer()
     assert serializer.loads(serializer.dumps(obj)) == obj