def __init__(self, datastore, serializer=None):
    '''Initializes internals and tests the serializer.

    Args:
      datastore: a child datastore for the ShimDatastore superclass.

      serializer: a serializer object (responds to loads and dumps).
    '''
    super(SerializerShimDatastore, self).__init__(datastore)

    if serializer:
      self.serializer = serializer

    # ensure serializer works
    test = { 'value': repr(self) }
    errstr = 'Serializer error: serialized value does not match original'
    assert self.serializer.loads(self.serializer.dumps(test)) == test, errstr
def __init__ ( self , datastore , serializer = None ) : super ( SerializerShimDatastore , self ) . __init__ ( datastore ) if serializer : self . serializer = serializer test = { 'value' : repr ( self ) } errstr = 'Serializer error: serialized value does not match original' assert self . serializer . loads ( self . serializer . dumps ( test ) ) == test , errstr
Initializes internals and tests the serializer.

    Args:
      datastore: a child datastore for the ShimDatastore superclass.

      serializer: a serializer object (responds to loads and dumps).