summaryrefslogtreecommitdiffstats
path: root/test/test_errors.py
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-06-26 06:24:58 +0000
commitba233a0cbad76b4783a03893e7bf4716fbc0f0ec (patch)
treead369728c1edbe3631c8150585659078ae5d7d0b /test/test_errors.py
parentReleasing progress-linux version 6.17.2-3~progress7.99u1. (diff)
downloadansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.tar.xz
ansible-lint-ba233a0cbad76b4783a03893e7bf4716fbc0f0ec.zip
Merging upstream version 24.6.1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'test/test_errors.py')
-rw-r--r--test/test_errors.py25
1 files changed, 25 insertions, 0 deletions
diff --git a/test/test_errors.py b/test/test_errors.py
new file mode 100644
index 0000000..69b7fe8
--- /dev/null
+++ b/test/test_errors.py
@@ -0,0 +1,25 @@
+"""Test ansiblelint.errors."""
+
+import pytest
+
+from ansiblelint.errors import MatchError
+
+
+def test_matcherror() -> None:
+ """."""
+ match = MatchError("foo", lineno=1, column=2)
+ with pytest.raises(TypeError):
+ assert match <= 0
+
+ assert match != 0
+
+ assert match.position == "1:2"
+
+ match2 = MatchError("foo", lineno=1)
+ assert match2.position == "1"
+
+ # str and repr are for the moment the same
+ assert str(match) == repr(match)
+
+ # tests implicit level
+ assert match.level == "warning"