def test_preprocessor_service_arguments(patch, magic, tree): patch.many(Preprocessor, ['fake_tree', 'replace_expression']) argument = magic() tree.find_data.return_value = [argument] Preprocessor.service_arguments('block', tree) Preprocessor.fake_tree.assert_called_with('block') tree.find_data.assert_called_with('arguments') argument.node.assert_called_with('values.inline_expression') args = (Preprocessor.fake_tree(), argument, argument.node()) Preprocessor.replace_expression.assert_called_with(*args)
def test_preprocessor_service_arguments(patch, magic, tree, fake_tree): patch.object(Preprocessor, 'replace_expression') argument = magic() tree.find_data.return_value = [argument] Preprocessor.service_arguments('block', tree) fake_tree.assert_called_with('block') tree.find_data.assert_called_with('arguments') argument.node.assert_called_with('entity.path.inline_expression') args = (fake_tree(), argument, argument.node()) Preprocessor.replace_expression.assert_called_with(*args)
def test_preprocessor_service_arguments_no_expression(patch, magic, tree): patch.many(Preprocessor, ['fake_tree', 'replace_expression']) argument = magic(inline_expression=None) tree.service_fragment.find_data.return_value = [argument] Preprocessor.service_arguments(magic(), tree) assert Preprocessor.replace_expression.call_count == 0