# 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,
#     )
# 
# def simple_class(
#     eq=False,
#     order=False,
#     repr=False,
#     hash=False,
#     str=False,
#     slots=False,
#     frozen=False,
#     cache_hash=False,
# ):
#     """
#     Return a new simple class.
#     """
#     return make_class(
#         "C",
#         ["a", "b"],
#         eq=eq or order,
#         order=order,
#         repr=repr,
#         hash=hash,
#         init=True,
#         slots=slots,
#         str=str,
#         frozen=frozen,
#         cache_hash=cache_hash,
#     )


import copy
import pickle
import pytest
import attr
from hypothesis import given
from hypothesis.strategies import booleans
from attr._make import (
    NOTHING,
    Factory,
    _add_repr,
    _is_slot_cls,
    _make_init,
    _Nothing,
    fields,
    make_class,
)
from attr.validators import instance_of
from .utils import simple_attr, simple_class
# so it needs to be tested separately
HashCFrozenNotSlotsCached = simple_class(
    frozen=True, slots=False, hash=True, cache_hash=True
)


def _add_init(cls, frozen):
    """
    Add a __init__ method to *cls*.  If *frozen* is True, make it immutable.

    This function used to be part of _make.  It wasn't used anymore however
    the tests for it are still useful to test the behavior of _make_init.
    """
    cls.__init__ = _make_init(
        cls,
        cls.__attrs_attrs__,
        getattr(cls, "__attrs_pre_init__", False),
        getattr(cls, "__attrs_post_init__", False),
        frozen,
        _is_slot_cls(cls),
        cache_hash=False,
        base_attr_map={},
        is_exc=False,
        cls_on_setattr=None,
        attrs_init=False,
    )
    return cls


class InitC(object):

# 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,
#     )
# 
# def simple_class(
#     eq=False,
#     order=False,
#     repr=False,
#     hash=False,
#     str=False,
#     slots=False,
#     frozen=False,
#     cache_hash=False,
# ):
#     """
#     Return a new simple class.
#     """
#     return make_class(
#         "C",
#         ["a", "b"],
#         eq=eq or order,
#         order=order,
#         repr=repr,
#         hash=hash,
#         init=True,
#         slots=slots,
#         str=str,
#         frozen=frozen,
#         cache_hash=cache_hash,
#     )


# Path: tests/test_dunders.py
import copy
import pickle
import pytest
import attr
from hypothesis import given
from hypothesis.strategies import booleans
from attr._make import (
    NOTHING,
    Factory,
    _add_repr,
    _is_slot_cls,
    _make_init,
    _Nothing,
    fields,
    make_class,
)
from attr.validators import instance_of
from .utils import simple_attr, simple_class

# so it needs to be tested separately
HashCFrozenNotSlotsCached = simple_class(
    frozen=True, slots=False, hash=True, cache_hash=True
)


def _add_init(cls, frozen):
    """
    Add a __init__ method to *cls*.  If *frozen* is True, make it immutable.

    This function used to be part of _make.  It wasn't used anymore however
    the tests for it are still useful to test the behavior of _make_init.
    """
    cls.__init__ = _make_init(
        cls,
        cls.__attrs_attrs__,
        getattr(cls, "__attrs_pre_init__", False),
        getattr(cls, "__attrs_post_init__", False),
        frozen,
        _is_slot_cls(cls),
        cache_hash=False,
        base_attr_map={},
        is_exc=False,
        cls_on_setattr=None,
        attrs_init=False,
    )
    return cls


class InitC(object):

    __attrs_attrs__ = [simple_attr("a"), simple_attr("b")]