summaryrefslogtreecommitdiffstats
path: root/tests/lib/utils.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 08:36:44 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-14 08:36:50 +0000
commit7763cc454d686d51bf2e0ccc1f2ccf7d62a0d625 (patch)
treef36d2006dd01bd01a069956741d831d9d5633377 /tests/lib/utils.py
parentAdding debian version 0.13.0-1. (diff)
downloadanta-7763cc454d686d51bf2e0ccc1f2ccf7d62a0d625.tar.xz
anta-7763cc454d686d51bf2e0ccc1f2ccf7d62a0d625.zip
Merging upstream version 0.14.0.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/lib/utils.py')
-rw-r--r--tests/lib/utils.py22
1 files changed, 7 insertions, 15 deletions
diff --git a/tests/lib/utils.py b/tests/lib/utils.py
index 460e014..1255936 100644
--- a/tests/lib/utils.py
+++ b/tests/lib/utils.py
@@ -1,9 +1,8 @@
# Copyright (c) 2023-2024 Arista Networks, Inc.
# Use of this source code is governed by the Apache License 2.0
# that can be found in the LICENSE file.
-"""
-tests.lib.utils
-"""
+"""tests.lib.utils."""
+
from __future__ import annotations
from pathlib import Path
@@ -11,22 +10,17 @@ from typing import Any
def generate_test_ids_dict(val: dict[str, Any], key: str = "name") -> str:
- """
- generate_test_ids Helper to generate test ID for parametrize
- """
+ """generate_test_ids Helper to generate test ID for parametrize."""
return val.get(key, "unamed_test")
def generate_test_ids_list(val: list[dict[str, Any]], key: str = "name") -> list[str]:
- """
- generate_test_ids Helper to generate test ID for parametrize
- """
- return [entry[key] if key in entry.keys() else "unamed_test" for entry in val]
+ """generate_test_ids Helper to generate test ID for parametrize."""
+ return [entry.get(key, "unamed_test") for entry in val]
def generate_test_ids(data: list[dict[str, Any]]) -> list[str]:
- """
- build id for a unit test of an AntaTest subclass
+ """Build id for a unit test of an AntaTest subclass.
{
"name": "meaniful test name",
@@ -38,9 +32,7 @@ def generate_test_ids(data: list[dict[str, Any]]) -> list[str]:
def default_anta_env() -> dict[str, str | None]:
- """
- Return a default_anta_environement which can be passed to a cliRunner.invoke method
- """
+ """Return a default_anta_environement which can be passed to a cliRunner.invoke method."""
return {
"ANTA_USERNAME": "anta",
"ANTA_PASSWORD": "formica",