diff --git a/murano/dsl/dsl.py b/murano/dsl/dsl.py index 4ff5ba2b4..d5aea9854 100644 --- a/murano/dsl/dsl.py +++ b/murano/dsl/dsl.py @@ -351,8 +351,9 @@ def to_mutable(obj, yaql_engine=None): else: return utils.convert_output_data(value, limit_func, engine, rec) - limiter = lambda it: utils.limit_iterable( - it, CONF.murano.dsl_iterators_limit) + def limiter(it): + return utils.limit_iterable(it, CONF.murano.dsl_iterators_limit) + return converter(obj, limiter, yaql_engine, converter) diff --git a/murano/dsl/meta.py b/murano/dsl/meta.py index c841c2e04..29cfdba7d 100644 --- a/murano/dsl/meta.py +++ b/murano/dsl/meta.py @@ -116,7 +116,8 @@ def merge_providers(initial_class, producer, context): def aggregate_meta(provider, context, group_by_name=True): - key_func = lambda m: m.type.name if group_by_name else m.type + def key_func(m): + return m.type.name if group_by_name else m.type meta = provider.get_meta(context) result = {} for item in meta: diff --git a/murano/dsl/yaql_integration.py b/murano/dsl/yaql_integration.py index fa27d297a..939dffb25 100644 --- a/murano/dsl/yaql_integration.py +++ b/murano/dsl/yaql_integration.py @@ -154,9 +154,10 @@ def _infer_parameter_type(name, class_name): def get_function_definition(func, murano_method, original_name): cls = murano_method.declaring_type.extension_class - param_type_func = \ - lambda name: None if not cls else _infer_parameter_type( - name, cls.__name__) + + def param_type_func(name): + return None if not cls else _infer_parameter_type(name, cls.__name__) + body = func if (cls is None or helpers.inspect_is_method(cls, original_name) or helpers.inspect_is_classmethod(cls, original_name)): diff --git a/murano/tests/unit/common/messaging/test_mqclient.py b/murano/tests/unit/common/messaging/test_mqclient.py index f24dec1db..d4caf0b8b 100644 --- a/murano/tests/unit/common/messaging/test_mqclient.py +++ b/murano/tests/unit/common/messaging/test_mqclient.py @@ -216,7 +216,8 @@ class MQClientTest(base.MuranoTestCase): def test_send_signed(self, mock_kombu): mock_message = mock.MagicMock(body='test_message', id=3) - signer = lambda msg: "SIGNATURE" + signer = mock.MagicMock() + signer.return_value = "SIGNATURE" self.ssl_client.connect() self.ssl_client.send(mock_message, 'test_key', 'test_exchange', signer) diff --git a/murano/tests/unit/dsl/test_helpers.py b/murano/tests/unit/dsl/test_helpers.py index e90839b20..1e38c2331 100644 --- a/murano/tests/unit/dsl/test_helpers.py +++ b/murano/tests/unit/dsl/test_helpers.py @@ -302,7 +302,8 @@ class TestDSLHelpers(base.MuranoTestCase): [mock.sentinel.second], [mock.sentinel.third] ] first_obj = mock.sentinel.first - handler = lambda i: True + handler = mock.MagicMock() + handler.return_value = True expected = [ [mock.sentinel.first], @@ -321,7 +322,8 @@ class TestDSLHelpers(base.MuranoTestCase): [mock.sentinel.second], [mock.sentinel.second] ] first_obj = mock.sentinel.first - handler = lambda i: True + handler = mock.MagicMock() + handler.return_value = True expected = [ [mock.sentinel.first], diff --git a/murano/tests/unit/dsl/test_session_local_storage.py b/murano/tests/unit/dsl/test_session_local_storage.py index 1ae4ec5a4..5d6743df0 100644 --- a/murano/tests/unit/dsl/test_session_local_storage.py +++ b/murano/tests/unit/dsl/test_session_local_storage.py @@ -97,7 +97,8 @@ class TestExecutionSessionMemoize(test_case.DslTestCase): @mock.patch.object(helpers, 'get_memoize_func', return_value=mock.sentinel.mem_func) def test_execution_session_memoize(self, mock_gef): - f = lambda: 'im a function' + f = mock.MagicMock() + f.return_value = 'im a function' new_f = session_local_storage.execution_session_memoize(f) self.assertEqual(f, mock_gef.call_args[0][0]) self.assertIsInstance(mock_gef.call_args[0][1],