# Path: snapshottest/sorted_dict.py
# class SortedDict(OrderedDict):
#     def __init__(self, values):
#         super(SortedDict, self).__init__()
# 
#         try:
#             sorted_items = sorted(values.items())
#         except TypeError:
#             # Enums are not sortable
#             sorted_items = values.items()
#         for key, value in sorted_items:
#             if isinstance(value, dict):
#                 self[key] = SortedDict(value)
#             elif isinstance(value, list):
#                 self[key] = self._sort_list(value)
#             else:
#                 self[key] = value
# 
#     def _sort_list(self, value):
#         def sort(val):
#             if isinstance(val, dict):
#                 return SortedDict(val)
#             elif isinstance(val, list):
#                 return self._sort_list(val)
#             else:
#                 return val
# 
#         return [sort(item) for item in value]


import enum
import pytest
from snapshottest.sorted_dict import SortedDict
        ("key8", [{"key": ["value"]}]),
    ],
)
def test_sorted_dict(key, value):
    dic = dict([(key, value)])
    assert SortedDict(dic)[key] == value


def test_sorted_dict_string_key():
    value = ("key", "value")
    dic = dict([value])
    assert SortedDict(dic)[value[0]] == value[1]


def test_sorted_dict_int_key():
    value = (0, "value")
    dic = dict([value])
    assert SortedDict(dic)[value[0]] == value[1]


def test_sorted_dict_intenum():
    class Fruit(enum.IntEnum):
        APPLE = 1
        ORANGE = 2

    dic = {
        Fruit.APPLE: 100,
        Fruit.ORANGE: 400,
    }
    assert SortedDict(dic)[Fruit.APPLE] == dic[Fruit.APPLE]

# Path: snapshottest/sorted_dict.py
# class SortedDict(OrderedDict):
#     def __init__(self, values):
#         super(SortedDict, self).__init__()
# 
#         try:
#             sorted_items = sorted(values.items())
#         except TypeError:
#             # Enums are not sortable
#             sorted_items = values.items()
#         for key, value in sorted_items:
#             if isinstance(value, dict):
#                 self[key] = SortedDict(value)
#             elif isinstance(value, list):
#                 self[key] = self._sort_list(value)
#             else:
#                 self[key] = value
# 
#     def _sort_list(self, value):
#         def sort(val):
#             if isinstance(val, dict):
#                 return SortedDict(val)
#             elif isinstance(val, list):
#                 return self._sort_list(val)
#             else:
#                 return val
# 
#         return [sort(item) for item in value]


# Path: tests/test_sorted_dict.py
import enum
import pytest
from snapshottest.sorted_dict import SortedDict

        ("key8", [{"key": ["value"]}]),
    ],
)
def test_sorted_dict(key, value):
    dic = dict([(key, value)])
    assert SortedDict(dic)[key] == value


def test_sorted_dict_string_key():
    value = ("key", "value")
    dic = dict([value])
    assert SortedDict(dic)[value[0]] == value[1]


def test_sorted_dict_int_key():
    value = (0, "value")
    dic = dict([value])
    assert SortedDict(dic)[value[0]] == value[1]


def test_sorted_dict_intenum():
    class Fruit(enum.IntEnum):
        APPLE = 1
        ORANGE = 2

    dic = {
        Fruit.APPLE: 100,
        Fruit.ORANGE: 400,
    }
    assert SortedDict(dic)[Fruit.APPLE] == dic[Fruit.APPLE]

    assert SortedDict(dic)[Fruit.ORANGE] == dic[Fruit.ORANGE]