def test_clone(case): result = _.clone(case) assert result is not case for key, value in _.helpers.iterator(result): assert value is case[key]
def test_clone(case, args): actual = _.clone(case, *args) assert actual is not case for key, value in _.helpers.iterator(actual): assert value is case[key]
async def _do_work(self): message_manager = self.context.message_manager; messages = self.context.blackboard.get('recv_messages') if messages and len(messages) > 0: msg_idx = pydash.find_index(messages, {'receiver': self.context.worker.uuid}) if msg_idx != -1: msg = pydash.clone(messages[msg_idx]) print('start handle message :{}'.format(msg)) pydash.pull_at(messages, msg_idx) self.context.blackboard.set('recv_messages', messages) message_inst = message_manager.find_message(msg['name']) if message_inst is None: print('malformed message handler: {}, {}'.format(msg['key'], {'message': msg})) self.async_task_status = py_trees.common.Status.FAILURE return try: await message_inst.on_handler(self.context, msg['body']) except Exception as err: print('error occurred while processing message : {}'.format({ 'message':msg })) self.async_task_status = py_trees.common.Status.SUCCESS
def test_clone_deep(case, kargs): kargs["is_deep"] = True actuals = [_.clone(case, **kargs), _.clone_deep(case, callback=kargs.get("callback"))] for actual in actuals: assert actual is not case for key, value in _.helpers.iterator(actual): assert value is not case[key]