Beispiel #1
0
 def next(self):
     result = self._wrapped.next()
     key_name = result.key.id()
     result_dict = db.unflatten(result.to_dict(),
                                token_map=self._token_map)
     result_dict['_id'] = key_name
     return result_dict
Beispiel #2
0
 def test_db_unflatten(self):
     document = {'_id': 'keyname1', 'deeply|nested|item': 1}
     assert db.unflatten(document) == {
         '_id': 'keyname1',
         'deeply': {
             'nested': {
                 'item': 1
             }
         }
     }
 def next(self):
     result = self._wrapped.next()
     if self._table not in ['metadata','tokenmaps']:
         result = db.unflatten(result, self._token_map)
     return result
Beispiel #4
0
 def test_db_flatten_unflatten(self):
     document = {"_id": "keyname1", "nested": {"item": 1}}
     assert db.unflatten(db.flatten(document)) == document
Beispiel #5
0
 def test_db_unflatten(self):
     document = {"_id": "keyname1", "deeply|nested|item": 1}
     assert db.unflatten(document) == {"_id": "keyname1", "deeply": {"nested": {"item": 1}}}
Beispiel #6
0
 def test_db_flatten_unflatten(self):
     document = {'_id': 'keyname1', 'nested': {'item': 1}}
     assert db.unflatten(db.flatten(document)) == document
 def next(self):
     result = self._wrapped.next()
     key_name = result.key.id()
     result_dict = db.unflatten(result.to_dict(), token_map = self._token_map)
     result_dict['_id'] = key_name
     return result_dict