# Path: tests/strategies.py
# def gen_attr_names():
# def maybe_underscore_prefix(source):
# def _create_hyp_nested_strategy(draw, simple_class_strategy):
# def simple_attrs_with_metadata(draw):
# def simple_classes(
#     draw, slots=None, frozen=None, weakref_slot=None, private_attrs=None
# ):
#         def pre_init(self):
#         def post_init(self):
#         def init(self, *args, **kwargs):
# 
# 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 copy
import functools
import gc
import inspect
import itertools
import sys
import pytest
import attr
from operator import attrgetter
from hypothesis import assume, given
from hypothesis.strategies import booleans, integers, lists, sampled_from, text
from attr import _config
from attr._compat import PY2, PY310, ordered_dict
from attr._make import (
    Attribute,
    Factory,
    _AndValidator,
    _Attributes,
    _ClassBuilder,
    _CountingAttr,
    _determine_attrib_eq_order,
    _determine_attrs_eq_order,
    _determine_whether_to_implement,
    _transform_attrs,
    and_,
    fields,
    fields_dict,
    make_class,
    validate,
)
from attr.exceptions import (
    DefaultAlreadySetError,
    NotAnAttrsClassError,
    PythonTooOldError,
)
from .strategies import (
    gen_attr_names,
    list_of_attrs,
    optional_bool,
    simple_attrs,
    simple_attrs_with_metadata,
    simple_attrs_without_metadata,
    simple_classes,
)
from .utils import simple_attr
        from types import new_class
        from typing import Generic, TypeVar

        assert "omg" == e.value.args[0]

    def test_multiple_empty(self):
        """
        Empty list/tuple for validator is the same as None.
        """
        C1 = make_class("C", {"x": attr.ib(validator=[])})
        C2 = make_class("C", {"x": attr.ib(validator=None)})

        assert inspect.getsource(C1.__init__) == inspect.getsource(C2.__init__)


# Hypothesis seems to cache values, so the lists of attributes come out
# unsorted.
sorted_lists_of_attrs = list_of_attrs.map(
    lambda l: sorted(l, key=attrgetter("counter"))
)


class TestMetadata(object):
    """
    Tests for metadata handling.
    """

    @given(sorted_lists_of_attrs)
    def test_metadata_present(self, list_of_attrs):
        """
        Assert dictionaries are copied and present.
        """

# Path: tests/strategies.py
# def gen_attr_names():
# def maybe_underscore_prefix(source):
# def _create_hyp_nested_strategy(draw, simple_class_strategy):
# def simple_attrs_with_metadata(draw):
# def simple_classes(
#     draw, slots=None, frozen=None, weakref_slot=None, private_attrs=None
# ):
#         def pre_init(self):
#         def post_init(self):
#         def init(self, *args, **kwargs):
# 
# 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_make.py
import copy
import functools
import gc
import inspect
import itertools
import sys
import pytest
import attr
from operator import attrgetter
from hypothesis import assume, given
from hypothesis.strategies import booleans, integers, lists, sampled_from, text
from attr import _config
from attr._compat import PY2, PY310, ordered_dict
from attr._make import (
    Attribute,
    Factory,
    _AndValidator,
    _Attributes,
    _ClassBuilder,
    _CountingAttr,
    _determine_attrib_eq_order,
    _determine_attrs_eq_order,
    _determine_whether_to_implement,
    _transform_attrs,
    and_,
    fields,
    fields_dict,
    make_class,
    validate,
)
from attr.exceptions import (
    DefaultAlreadySetError,
    NotAnAttrsClassError,
    PythonTooOldError,
)
from .strategies import (
    gen_attr_names,
    list_of_attrs,
    optional_bool,
    simple_attrs,
    simple_attrs_with_metadata,
    simple_attrs_without_metadata,
    simple_classes,
)
from .utils import simple_attr
        from types import new_class
        from typing import Generic, TypeVar


        assert "omg" == e.value.args[0]

    def test_multiple_empty(self):
        """
        Empty list/tuple for validator is the same as None.
        """
        C1 = make_class("C", {"x": attr.ib(validator=[])})
        C2 = make_class("C", {"x": attr.ib(validator=None)})

        assert inspect.getsource(C1.__init__) == inspect.getsource(C2.__init__)


# Hypothesis seems to cache values, so the lists of attributes come out
# unsorted.
sorted_lists_of_attrs = list_of_attrs.map(
    lambda l: sorted(l, key=attrgetter("counter"))
)


class TestMetadata(object):
    """
    Tests for metadata handling.
    """

    @given(sorted_lists_of_attrs)
    def test_metadata_present(self, list_of_attrs):
        """
        Assert dictionaries are copied and present.
        """

        C = make_class("C", dict(zip(gen_attr_names(), list_of_attrs)))