# Path: tests/utils.py
# def simple_attr(
#     name,
#     default=NOTHING,
#     validator=None,
#     repr=True,
#     eq=True,
#     hash=None,
#     init=True,
#     converter=None,
#     kw_only=False,
#     inherited=False,
# ):
#     """
#     Return an attribute with a name and no other bells and whistles.
#     """
#     return Attribute(
#         name=name,
#         default=default,
#         validator=validator,
#         repr=repr,
#         cmp=None,
#         eq=eq,
#         hash=hash,
#         init=init,
#         converter=converter,
#         kw_only=kw_only,
#         inherited=inherited,
#     )


import re
import pytest
import attr
        import zope.interface
from attr import _config, fields, has
from attr import validators as validator_module
from attr._compat import PY2, TYPE
from attr.validators import (
    and_,
    deep_iterable,
    deep_mapping,
    ge,
    gt,
    in_,
    instance_of,
    is_callable,
    le,
    lt,
    matches_re,
    max_len,
    min_len,
    optional,
    provides,
)
from .utils import simple_attr
        from attr.exceptions import NotCallableError
        """
        Running validators is re-enabled even if an error is raised.
        """
        assert _config._run_validators is True

        with pytest.raises(ValueError):
            with validator_module.disabled():
                assert _config._run_validators is False

                raise ValueError("haha!")

        assert _config._run_validators is True


class TestInstanceOf(object):
    """
    Tests for `instance_of`.
    """

    def test_in_all(self):
        """
        Verify that this validator is in ``__all__``.
        """
        assert instance_of.__name__ in validator_module.__all__

    def test_success(self):
        """
        Nothing happens if types match.
        """
        v = instance_of(int)

# Path: tests/utils.py
# def simple_attr(
#     name,
#     default=NOTHING,
#     validator=None,
#     repr=True,
#     eq=True,
#     hash=None,
#     init=True,
#     converter=None,
#     kw_only=False,
#     inherited=False,
# ):
#     """
#     Return an attribute with a name and no other bells and whistles.
#     """
#     return Attribute(
#         name=name,
#         default=default,
#         validator=validator,
#         repr=repr,
#         cmp=None,
#         eq=eq,
#         hash=hash,
#         init=init,
#         converter=converter,
#         kw_only=kw_only,
#         inherited=inherited,
#     )


# Path: tests/test_validators.py
import re
import pytest
import attr
        import zope.interface
from attr import _config, fields, has
from attr import validators as validator_module
from attr._compat import PY2, TYPE
from attr.validators import (
    and_,
    deep_iterable,
    deep_mapping,
    ge,
    gt,
    in_,
    instance_of,
    is_callable,
    le,
    lt,
    matches_re,
    max_len,
    min_len,
    optional,
    provides,
)
from .utils import simple_attr
        from attr.exceptions import NotCallableError

        """
        Running validators is re-enabled even if an error is raised.
        """
        assert _config._run_validators is True

        with pytest.raises(ValueError):
            with validator_module.disabled():
                assert _config._run_validators is False

                raise ValueError("haha!")

        assert _config._run_validators is True


class TestInstanceOf(object):
    """
    Tests for `instance_of`.
    """

    def test_in_all(self):
        """
        Verify that this validator is in ``__all__``.
        """
        assert instance_of.__name__ in validator_module.__all__

    def test_success(self):
        """
        Nothing happens if types match.
        """
        v = instance_of(int)

        v(None, simple_attr("test"), 42)