import re

import pytest

from valtypes import Pattern
from valtypes.exception import PatternError


def test_pattern() -> None:
    a = Pattern(re.compile("abc"))

    a("abc")

    with pytest.raises(PatternError):
        a("def")
