# Path: concepts/lattices.py
# class Data:
# class FormattingMixin:
# class CollectionMixin:
# class AggregagtionMixin:
# class NavigateableMixin:
# class VisualizableMixin:
# class Lattice(VisualizableMixin, NavigateableMixin, AggregagtionMixin,
#               CollectionMixin, FormattingMixin, Data):
#     def _longlex(concept):
#     def _shortlex(concept):
#     def _fromlist(cls, context, lattice, unordered) -> 'Lattice':
#     def __init__(self, context: 'contexts.Context', infimum=()) -> None:
#     def _make_mapping(concepts):
#     def _init(inst,
#               context: 'contexts.Context',
#               concepts,
#               mapping=None, unpickle=False) -> None:
#     def _annotate(context, mapping):
#     def __getstate__(self):
#     def __setstate__(self, state):
#     def _tolist(self):
#     def _eq(self, other) -> typing.Union[type(NotImplemented), bool]:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __call__(self, properties: typing.Tuple[str]) -> Concept:
#     def __getitem__(self, key: typing.Union[int, typing.Tuple[str, ...]]
#                     ) -> Concept:
#     def __iter__(self) -> typing.Iterator[Concept]:
#     def __len__(self) -> int:
#     def join(self, concepts: typing.Iterable[Concept]) -> Concept:
#     def meet(self, concepts: typing.Iterable[Concept]) -> Concept:
#     def upset_union(self, concepts: typing.Iterable[Concept],
#                     _sortkey=operator.attrgetter('index'),
#                     _next_concepts=operator.attrgetter('upper_neighbors')
#                     ) -> typing.Iterator[Concept]:
#     def downset_union(self, concepts: typing.Iterable[Concept],
#                     _sortkey=operator.attrgetter('dindex'),
#                     _next_concepts=operator.attrgetter('lower_neighbors')
#                       ) -> typing.Iterator[Concept]:
#     def upset_generalization(self, concepts: typing.Iterable[Concept]
#                              ) -> typing.Iterator[Concept]:
#     def graphviz(self, filename=None, directory=None,
#                  render: bool = False,
#                  view: bool = False,
#                  make_object_label=' '.join,
#                  make_property_label=' '.join,
#                  **kwargs) -> graphviz.Digraph:
#     def infimum(self) -> Infimum:
#     def supremum(self) -> Supremum:
#     def atoms(self) -> typing.Tuple[Atom, ...]:


import functools
import pickle
import pytest
import concepts
from concepts import lattices
    other = concepts.Context(*lattice._context.definition()).lattice
    c = other[16]

    for attname in ('index', 'dindex'):
        i = getattr(c, attname)
        setattr(c, attname, -1)
        assert not other._eq(lattice)
        setattr(c, attname, i)

    for attname in ('atoms', 'properties', 'objects'):
        t = tuple(getattr(c, attname))
        if attname == 'objects':
            setattr(c, attname, ('spam',))
        else:
            setattr(c, attname, tuple(reversed(t)))
        assert not other._eq(lattice)
        setattr(c, attname, t)


def test_concept_eq_nonconcept(lattice):
    assert lattice[1]._eq(object()) is NotImplemented


def test_concept_eq(lattice):
    assert lattice[5]._eq(lattice[5])
    assert not lattice[1]._eq(lattice[7])


def test_concept_eq_neighors(lattice):
    c = lattice[7]

# Path: concepts/lattices.py
# class Data:
# class FormattingMixin:
# class CollectionMixin:
# class AggregagtionMixin:
# class NavigateableMixin:
# class VisualizableMixin:
# class Lattice(VisualizableMixin, NavigateableMixin, AggregagtionMixin,
#               CollectionMixin, FormattingMixin, Data):
#     def _longlex(concept):
#     def _shortlex(concept):
#     def _fromlist(cls, context, lattice, unordered) -> 'Lattice':
#     def __init__(self, context: 'contexts.Context', infimum=()) -> None:
#     def _make_mapping(concepts):
#     def _init(inst,
#               context: 'contexts.Context',
#               concepts,
#               mapping=None, unpickle=False) -> None:
#     def _annotate(context, mapping):
#     def __getstate__(self):
#     def __setstate__(self, state):
#     def _tolist(self):
#     def _eq(self, other) -> typing.Union[type(NotImplemented), bool]:
#     def __str__(self) -> str:
#     def __repr__(self) -> str:
#     def __call__(self, properties: typing.Tuple[str]) -> Concept:
#     def __getitem__(self, key: typing.Union[int, typing.Tuple[str, ...]]
#                     ) -> Concept:
#     def __iter__(self) -> typing.Iterator[Concept]:
#     def __len__(self) -> int:
#     def join(self, concepts: typing.Iterable[Concept]) -> Concept:
#     def meet(self, concepts: typing.Iterable[Concept]) -> Concept:
#     def upset_union(self, concepts: typing.Iterable[Concept],
#                     _sortkey=operator.attrgetter('index'),
#                     _next_concepts=operator.attrgetter('upper_neighbors')
#                     ) -> typing.Iterator[Concept]:
#     def downset_union(self, concepts: typing.Iterable[Concept],
#                     _sortkey=operator.attrgetter('dindex'),
#                     _next_concepts=operator.attrgetter('lower_neighbors')
#                       ) -> typing.Iterator[Concept]:
#     def upset_generalization(self, concepts: typing.Iterable[Concept]
#                              ) -> typing.Iterator[Concept]:
#     def graphviz(self, filename=None, directory=None,
#                  render: bool = False,
#                  view: bool = False,
#                  make_object_label=' '.join,
#                  make_property_label=' '.join,
#                  **kwargs) -> graphviz.Digraph:
#     def infimum(self) -> Infimum:
#     def supremum(self) -> Supremum:
#     def atoms(self) -> typing.Tuple[Atom, ...]:


# Path: tests/test_lattices.py
import functools
import pickle
import pytest
import concepts
from concepts import lattices

    other = concepts.Context(*lattice._context.definition()).lattice
    c = other[16]

    for attname in ('index', 'dindex'):
        i = getattr(c, attname)
        setattr(c, attname, -1)
        assert not other._eq(lattice)
        setattr(c, attname, i)

    for attname in ('atoms', 'properties', 'objects'):
        t = tuple(getattr(c, attname))
        if attname == 'objects':
            setattr(c, attname, ('spam',))
        else:
            setattr(c, attname, tuple(reversed(t)))
        assert not other._eq(lattice)
        setattr(c, attname, t)


def test_concept_eq_nonconcept(lattice):
    assert lattice[1]._eq(object()) is NotImplemented


def test_concept_eq(lattice):
    assert lattice[5]._eq(lattice[5])
    assert not lattice[1]._eq(lattice[7])


def test_concept_eq_neighors(lattice):
    c = lattice[7]

    mock_concept = functools.partial(lattices.Concept, c.lattice, c._extent, c._intent)