Debian Codegraph @

test/units/utils/test_listify.py

raw
1 # Copyright: Contributors to the Ansible project
2 # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
3
4 from __future__ import annotations
5
6 import typing as t
7
8 import pytest
9 import pytest_mock
10
11 from ansible.utils.display import Display
12 from ansible.utils.listify import listify_lookup_plugin_terms
13
14
15 @pytest.mark.parametrize("test_input, expected", (
16 ([], []),
17 ("foo", ["foo"]),
18 (["foo"], ["foo"]),
19 ), ids=str)
20 def test_listify_lookup_plugin_terms(test_input: t.Any, expected: t.Any, mocker: pytest_mock.MockerFixture) -> None:
21 with mocker.patch.object(Display(), 'deprecated'): # as deprecated:
22 assert listify_lookup_plugin_terms(test_input) == expected
23
24 # deprecated: description="Calling listify_lookup_plugin_terms function is not necessary; the function should be deprecated." core_version="2.23"
25 # deprecated.assert_called_once_with(
26 # msg='"listify_lookup_plugin_terms" is obsolete and in most cases unnecessary',
27 # version='2.23',
28 # )