import inspect

from nose.tools import ok_

from mordred import descriptors, get_descriptors_from_module
from mordred._base.descriptor import is_descriptor_class


def test_attributes():
    for mdl in descriptors.all:
        for desc in get_descriptors_from_module(mdl):
            for cls in desc.__mro__:
                if cls == object:
                    continue

                if is_descriptor_class(desc, include_abstract=True):
                    yield (
                        ok_,
                        "__slots__" in cls.__dict__,
                        "{}({}) class don't have __slots__".format(
                            cls.__name__, inspect.getfile(desc),
                        ),
                    )

            yield (
                ok_,
                "since" in desc.__dict__,
                "{}({}) class don't have since".format(
                    desc.__name__, inspect.getfile(desc),
                ),
            )
