def test_pack_float(self): packed = pack(3.14) unpacked = unpack(packed) self.assertEqual(unpacked[0], 3.14)
def test_pack_multi(self): packed = pack(123, 'foobar', 3.14, dict(a='b')) unpacked = unpack(packed) self.assertEqual(unpacked, [123, 'foobar', 3.14, dict(a='b')])
def test_pack_dict(self): packed = pack(dict(a=1)) unpacked = unpack(packed) self.assertEqual(unpacked[0], dict(a=1))
def test_pack_int(self): packed = pack(123) unpacked = unpack(packed) self.assertEqual(unpacked[0], 123)
def test_pack_multi_str(self): packed = pack('foobar', 'spam', 'egg') unpacked = unpack(packed) self.assertEqual(unpacked, ['foobar', 'spam', 'egg'])
def test_pack_unicode(self): packed = pack(u'foobar') unpacked = unpack(packed) self.assertEqual(unpacked[0], u'foobar')
def test_pack_str(self): packed = pack('foobar') unpacked = unpack(packed) self.assertEqual(unpacked[0], 'foobar')