File: test_errors.py

package info (click to toggle)
ansible-lint 25.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 5,660 kB
  • sloc: python: 19,201; sh: 70; makefile: 7
file content (25 lines) | stat: -rw-r--r-- 529 bytes parent folder | download | duplicates (2)
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
"""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"