def test_serializer_handles_paddings(self): """serializer handles missing paddings""" for i in xrange(100): wet = 'Lorem ipsum %s' % ('a' * i) dry = serializer.dumps(wet) self.assertFalse(dry.endswith('=')) self.assertEqual(wet, serializer.loads(dry))
def test_serializer(self): """serializer dehydrates and hydrates values""" TEST_CASES = ( 'LoremIpsum', 123, [1, 2, '4d'], {'bawww': 'zong', 23: True} ) for wet in TEST_CASES: dry = serializer.dumps(wet) self.assertEqual(wet, serializer.loads(dry))
def permissions(self): try: return self.permissions_cache except AttributeError: if self.pickled_permissions: self.permissions_cache = serializer.loads( self.pickled_permissions) else: self.permissions_cache = {} return self.permissions_cache
def test_serializer(self): """serializer dehydrates and hydrates values""" TEST_CASES = ('LoremIpsum', 123, [1, 2, '4d'], { 'bawww': 'zong', 23: True }) for wet in TEST_CASES: dry = serializer.dumps(wet) self.assertEqual(wet, serializer.loads(dry))
def field_extra(self): if self.pickled_field_extra: return serializer.loads(self.pickled_field_extra) else: return {}