File: test_listify.py

package info (click to toggle)
ansible-core 2.19.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 32,752 kB
  • sloc: python: 181,000; cs: 4,929; sh: 4,611; xml: 34; makefile: 21
file content (28 lines) | stat: -rw-r--r-- 1,035 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# Copyright: Contributors to the Ansible project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)

from __future__ import annotations

import typing as t

import pytest
import pytest_mock

from ansible.utils.display import Display
from ansible.utils.listify import listify_lookup_plugin_terms


@pytest.mark.parametrize("test_input, expected", (
    ([], []),
    ("foo", ["foo"]),
    (["foo"], ["foo"]),
), ids=str)
def test_listify_lookup_plugin_terms(test_input: t.Any, expected: t.Any, mocker: pytest_mock.MockerFixture) -> None:
    with mocker.patch.object(Display(), 'deprecated'):  # as deprecated:
        assert listify_lookup_plugin_terms(test_input) == expected

    # deprecated: description="Calling listify_lookup_plugin_terms function is not necessary; the function should be deprecated." core_version="2.23"
    # deprecated.assert_called_once_with(
    #     msg='"listify_lookup_plugin_terms" is obsolete and in most cases unnecessary',
    #     version='2.23',
    # )