# Path: tessagon/core/tessagon_discovery.py
# class TessagonDiscovery:
#     def __init__(self, **kwargs):
#         self.classes = kwargs.get('classes', ALL)
# 
#     def count(self):
#         return len(self.classes)
# 
#     def to_list(self):
#         return self.classes
# 
#     def inverse(self):
#         other_classes = list(set(ALL) - set(self.classes))
#         return TessagonDiscovery(classes=other_classes)
# 
#     def __add__(self, other):
#         new_classes = list(set(self.classes) | set(other.classes))
#         return TessagonDiscovery(classes=new_classes)
# 
#     def __sub__(self, other):
#         new_classes = list(set(self.classes) - set(other.classes))
#         return TessagonDiscovery(classes=new_classes)
# 
#     def with_color_patterns(self):
#         results = []
#         for klass in self.classes:
#             if klass.metadata is None:
#                 continue
#             if klass.metadata.has_color_patterns():
#                 results.append(klass)
#         return TessagonDiscovery(classes=results)
# 
#     def with_classification(self, classification):
#         results = []
#         for klass in self.classes:
#             if klass.metadata is None:
#                 continue
#             if klass.metadata.has_classification(classification):
#                 results.append(klass)
#         return TessagonDiscovery(classes=results)
# 
#     @classmethod
#     def get_class(cls, class_name):
#         if class_name in globals():
#             klass = globals()[class_name]
#             if klass in ALL:
#                 return klass
#         raise ValueError(class_name + ' is not recognized by Tessagon')
# 
# Path: tessagon/types/hex_tessagon.py
# class HexTessagon(Tessagon):
#     tile_class = HexTile
#     metadata = metadata
# 
# Path: tessagon/types/tri_tessagon.py
# class TriTessagon(Tessagon):
#     tile_class = TriTile
#     metadata = metadata
# 
# Path: tessagon/types/square_tessagon.py
# class SquareTessagon(Tessagon):
#     tile_class = SquareTile
#     metadata = metadata


from core_tests_base import CoreTestsBase
from tessagon.core.tessagon_discovery import TessagonDiscovery
from tessagon.types.hex_tessagon import HexTessagon
from tessagon.types.tri_tessagon import TriTessagon
from tessagon.types.square_tessagon import SquareTessagon
    def test_inverse(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        find_all_count = find_all.count()
        assert find_all_count >= 23
        regular_count = regular.count()
        assert regular_count == 3
        assert inverse.count() + regular_count == find_all_count

        assert set(regular.to_list()) | set(inverse.to_list()) == \
            set(find_all.to_list())

    def test_addition(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        assert set((regular + inverse).to_list()) == set(find_all.to_list())

    def test_subtraction(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        assert set((find_all - regular).to_list()) == set(inverse.to_list())
        assert (find_all - find_all).to_list() == []

    def test_with_color_pattern(self):

# Path: tessagon/core/tessagon_discovery.py
# class TessagonDiscovery:
#     def __init__(self, **kwargs):
#         self.classes = kwargs.get('classes', ALL)
# 
#     def count(self):
#         return len(self.classes)
# 
#     def to_list(self):
#         return self.classes
# 
#     def inverse(self):
#         other_classes = list(set(ALL) - set(self.classes))
#         return TessagonDiscovery(classes=other_classes)
# 
#     def __add__(self, other):
#         new_classes = list(set(self.classes) | set(other.classes))
#         return TessagonDiscovery(classes=new_classes)
# 
#     def __sub__(self, other):
#         new_classes = list(set(self.classes) - set(other.classes))
#         return TessagonDiscovery(classes=new_classes)
# 
#     def with_color_patterns(self):
#         results = []
#         for klass in self.classes:
#             if klass.metadata is None:
#                 continue
#             if klass.metadata.has_color_patterns():
#                 results.append(klass)
#         return TessagonDiscovery(classes=results)
# 
#     def with_classification(self, classification):
#         results = []
#         for klass in self.classes:
#             if klass.metadata is None:
#                 continue
#             if klass.metadata.has_classification(classification):
#                 results.append(klass)
#         return TessagonDiscovery(classes=results)
# 
#     @classmethod
#     def get_class(cls, class_name):
#         if class_name in globals():
#             klass = globals()[class_name]
#             if klass in ALL:
#                 return klass
#         raise ValueError(class_name + ' is not recognized by Tessagon')
# 
# Path: tessagon/types/hex_tessagon.py
# class HexTessagon(Tessagon):
#     tile_class = HexTile
#     metadata = metadata
# 
# Path: tessagon/types/tri_tessagon.py
# class TriTessagon(Tessagon):
#     tile_class = TriTile
#     metadata = metadata
# 
# Path: tessagon/types/square_tessagon.py
# class SquareTessagon(Tessagon):
#     tile_class = SquareTile
#     metadata = metadata


# Path: tests/core/test_tessagon_discovery.py
from core_tests_base import CoreTestsBase
from tessagon.core.tessagon_discovery import TessagonDiscovery
from tessagon.types.hex_tessagon import HexTessagon
from tessagon.types.tri_tessagon import TriTessagon
from tessagon.types.square_tessagon import SquareTessagon

    def test_inverse(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        find_all_count = find_all.count()
        assert find_all_count >= 23
        regular_count = regular.count()
        assert regular_count == 3
        assert inverse.count() + regular_count == find_all_count

        assert set(regular.to_list()) | set(inverse.to_list()) == \
            set(find_all.to_list())

    def test_addition(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        assert set((regular + inverse).to_list()) == set(find_all.to_list())

    def test_subtraction(self):
        find_all = TessagonDiscovery()
        regular = find_all.with_classification('regular')
        inverse = regular.inverse()

        assert set((find_all - regular).to_list()) == set(inverse.to_list())
        assert (find_all - find_all).to_list() == []

    def test_with_color_pattern(self):

        color = TessagonDiscovery().with_color_patterns()