1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2026-04-15 16:31:30 +00:00

Reformat everything.

This commit is contained in:
Felix Fontein 2025-11-01 12:08:41 +01:00
parent 3f2213791a
commit 340ff8586d
1008 changed files with 61301 additions and 58309 deletions

View file

@ -12,36 +12,12 @@ from ansible_collections.community.general.plugins.module_utils.opennebula impor
FLATTEN_VALID = [
(
[[[1]], [2], 3],
False,
[1, 2, 3]
),
(
[[[1]], [2], 3],
True,
[1, 2, 3]
),
(
[[1]],
False,
[1]
),
(
[[1]],
True,
1
),
(
1,
False,
[1]
),
(
1,
True,
1
),
([[[1]], [2], 3], False, [1, 2, 3]),
([[[1]], [2], 3], True, [1, 2, 3]),
([[1]], False, [1]),
([[1]], True, 1),
(1, False, [1]),
(1, True, 1),
]
RENDER_VALID = [
@ -51,11 +27,11 @@ RENDER_VALID = [
"CPU": 1,
"MEMORY": 1024,
},
textwrap.dedent('''
textwrap.dedent("""
CPU="1"
MEMORY="1024"
NIC=[NAME="NIC0",NETWORK_ID="0"]
''').strip()
""").strip(),
),
(
{
@ -66,35 +42,35 @@ RENDER_VALID = [
"CPU": 1,
"MEMORY": 1024,
},
textwrap.dedent('''
textwrap.dedent("""
CPU="1"
MEMORY="1024"
NIC=[NAME="NIC0",NETWORK_ID="0"]
NIC=[NAME="NIC1",NETWORK_ID="1"]
''').strip()
""").strip(),
),
(
{
'EMPTY_VALUE': None,
'SCHED_REQUIREMENTS': 'CLUSTER_ID="100"',
'BACKSLASH_ESCAPED': "this is escaped: \\n; this isn't: \"\nend",
"EMPTY_VALUE": None,
"SCHED_REQUIREMENTS": 'CLUSTER_ID="100"',
"BACKSLASH_ESCAPED": "this is escaped: \\n; this isn't: \"\nend",
},
textwrap.dedent('''
textwrap.dedent("""
BACKSLASH_ESCAPED="this is escaped: \\\\n; this isn't: \\"
end"
SCHED_REQUIREMENTS="CLUSTER_ID=\\"100\\""
''').strip()
""").strip(),
),
]
@pytest.mark.parametrize('to_flatten,extract,expected_result', FLATTEN_VALID)
@pytest.mark.parametrize("to_flatten,extract,expected_result", FLATTEN_VALID)
def test_flatten(to_flatten, extract, expected_result):
result = flatten(to_flatten, extract)
assert result == expected_result, repr(result)
@pytest.mark.parametrize('to_render,expected_result', RENDER_VALID)
@pytest.mark.parametrize("to_render,expected_result", RENDER_VALID)
def test_render(to_render, expected_result):
result = render(to_render)
assert result == expected_result, repr(result)