summaryrefslogtreecommitdiffstats
path: root/tests/units/tools/test_misc.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/units/tools/test_misc.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/units/tools/test_misc.py')
-rw-r--r--tests/units/tools/test_misc.py38
1 files changed, 0 insertions, 38 deletions
diff --git a/tests/units/tools/test_misc.py b/tests/units/tools/test_misc.py
deleted file mode 100644
index c453c21..0000000
--- a/tests/units/tools/test_misc.py
+++ /dev/null
@@ -1,38 +0,0 @@
-# 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 for anta.tools.misc
-"""
-from __future__ import annotations
-
-import pytest
-
-from anta.tools.misc import exc_to_str, tb_to_str
-
-
-def my_raising_function(exception: Exception) -> None:
- """
- dummy function to raise Exception
- """
- raise exception
-
-
-@pytest.mark.parametrize("exception, expected_output", [(ValueError("test"), "ValueError (test)"), (ValueError(), "ValueError")])
-def test_exc_to_str(exception: Exception, expected_output: str) -> None:
- """
- Test exc_to_str
- """
- assert exc_to_str(exception) == expected_output
-
-
-def test_tb_to_str() -> None:
- """
- Test tb_to_str
- """
- try:
- my_raising_function(ValueError("test"))
- except ValueError as e:
- output = tb_to_str(e)
- assert "Traceback" in output
- assert 'my_raising_function(ValueError("test"))' in output