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
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
def test_db_flatten_unflatten(self): document = {"_id": "keyname1", "nested": {"item": 1}} assert db.unflatten(db.flatten(document)) == document
def test_db_unflatten(self): document = {"_id": "keyname1", "deeply|nested|item": 1} assert db.unflatten(document) == {"_id": "keyname1", "deeply": {"nested": {"item": 1}}}
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