def test_encode(self): data = {'string': 'some_string', 'int': 1234} expected = ( '\x82\xc4\x03int\xcd\x04\xd2\xc4\x06string\xc4\x0bsome_string') retval = MSGPackSerializer.dump(data) self.assertEqual(retval, expected) self.assertTrue(isinstance(retval, str))
def test_decode(self): data = ( '\x82\xc4\x03int\xcd\x04\xd2\xc4\x06string\xc4\x0bsome_string' ) expected = { 'string': 'some_string', 'int': 1234 } retval = MSGPackSerializer.load(data) self.assertEqual(retval, expected) self.assertTrue(isinstance(retval, dict))
def test_encode(self): data = { 'string': 'some_string', 'int': 1234 } expected = ( '\x82\xc4\x03int\xcd\x04\xd2\xc4\x06string\xc4\x0bsome_string' ) retval = MSGPackSerializer.dump(data) self.assertEqual(retval, expected) self.assertTrue(isinstance(retval, str))
def test_decode(self): data = ('\x82\xc4\x03int\xcd\x04\xd2\xc4\x06string\xc4\x0bsome_string') expected = {'string': 'some_string', 'int': 1234} retval = MSGPackSerializer.load(data) self.assertEqual(retval, expected) self.assertTrue(isinstance(retval, dict))