# Path: panflute/elements.py
# def builtin2meta(val):
#     type_ = type(val)
#     if type_ in _builtin_to_meta_func:
#         return _builtin_to_meta_func[type_](val)
#     # support subclassed builtins. see https://github.com/sergiocorreia/panflute/issues/166
#     for builtin_type, meta_func in _builtin_to_meta_func.items():
#         if isinstance(val, builtin_type):
#             return meta_func(val)
#     return val
# 
# class MetaList(MetaValue):
#     """Metadata list container
# 
#     :param args: contents of a metadata list
#     :type args: :class:`MetaValue`
#     :Base: :class:`MetaValue`
#     """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args):
#         args = [builtin2meta(v) for v in args]
#         self._set_content(args, MetaValue)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
#     def __getitem__(self, i):
#         return self.content[i]
# 
#     def __setitem__(self, i, v):
#         self.content[i] = builtin2meta(v)
# 
#     def append(self, i):
#         self.content.append(i)
# 
# class MetaMap(MetaValue):
#     """Metadata container for ordered dicts
# 
#     :param args: (key, value) tuples
#     :type args: :class:`MetaValue`
#     :param kwargs: named arguments
#     :type kwargs: :class:`MetaValue`
#     :Base: :class:`MetaValue`
#     """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args, **kwargs):
#         args = list(args)
#         if kwargs:
#             args.extend(kwargs.items())
#         args = [(k, builtin2meta(v)) for k, v in args]
#         self._content = DictContainer(*args, oktypes=MetaValue, parent=self)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
#     @property
#     def content(self):
#         """
#         Map of :class:`MetaValue` objects.
#         """
#         return self._content
# 
#     @content.setter
#     def content(self, value):
#         if isinstance(value, dict):
#             value = value.dict.items()
#         self._content = DictContainer(*value, oktypes=MetaValue, parent=self)
# 
#     # These two are convenience functions, not sure if really needed...
#     # (they save typing the .content and converting to metavalues)
#     def __getitem__(self, i):
#         return self.content[i]
# 
#     def __setitem__(self, i, v):
#         self.content[i] = builtin2meta(v)
# 
#     def __contains__(self, i):
#         return i in self.content
# 
# class MetaString(MetaValue):
#     """
#     Text (a string)
# 
#     :param text: a string of unformatted text
#     :type text: :class:`str`
#     :Base: :class:`MetaValue`
#      """
#     # Note: this is the same as the Str class but with a MetaValue parent
# 
#     __slots__ = ['text']
# 
#     def __init__(self, text):
#         self.text = check_type(text, str)
# 
#     def __repr__(self):
#         return 'MetaString({})'.format(self.text)
# 
#     def _slots_to_json(self):
#         return self.text


import pytest
from panflute.elements import builtin2meta, MetaList, MetaMap, MetaString



class My_List(list):
    """Subclass for testing https://github.com/sergiocorreia/panflute/issues/166"""
    pass


class My_Dict(dict):
    """Subclass for testing https://github.com/sergiocorreia/panflute/issues/166"""
    pass


class Not_Builtin:
    pass


@pytest.mark.parametrize(
    "value,expect_type",
    [
        ([], MetaList),
        ({}, MetaMap),
        (My_List(), MetaList),
        (My_Dict(), MetaMap),

# Path: panflute/elements.py
# def builtin2meta(val):
#     type_ = type(val)
#     if type_ in _builtin_to_meta_func:
#         return _builtin_to_meta_func[type_](val)
#     # support subclassed builtins. see https://github.com/sergiocorreia/panflute/issues/166
#     for builtin_type, meta_func in _builtin_to_meta_func.items():
#         if isinstance(val, builtin_type):
#             return meta_func(val)
#     return val
# 
# class MetaList(MetaValue):
#     """Metadata list container
# 
#     :param args: contents of a metadata list
#     :type args: :class:`MetaValue`
#     :Base: :class:`MetaValue`
#     """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args):
#         args = [builtin2meta(v) for v in args]
#         self._set_content(args, MetaValue)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
#     def __getitem__(self, i):
#         return self.content[i]
# 
#     def __setitem__(self, i, v):
#         self.content[i] = builtin2meta(v)
# 
#     def append(self, i):
#         self.content.append(i)
# 
# class MetaMap(MetaValue):
#     """Metadata container for ordered dicts
# 
#     :param args: (key, value) tuples
#     :type args: :class:`MetaValue`
#     :param kwargs: named arguments
#     :type kwargs: :class:`MetaValue`
#     :Base: :class:`MetaValue`
#     """
#     __slots__ = ['_content']
#     _children = ['content']
# 
#     def __init__(self, *args, **kwargs):
#         args = list(args)
#         if kwargs:
#             args.extend(kwargs.items())
#         args = [(k, builtin2meta(v)) for k, v in args]
#         self._content = DictContainer(*args, oktypes=MetaValue, parent=self)
# 
#     def _slots_to_json(self):
#         return self.content.to_json()
# 
#     @property
#     def content(self):
#         """
#         Map of :class:`MetaValue` objects.
#         """
#         return self._content
# 
#     @content.setter
#     def content(self, value):
#         if isinstance(value, dict):
#             value = value.dict.items()
#         self._content = DictContainer(*value, oktypes=MetaValue, parent=self)
# 
#     # These two are convenience functions, not sure if really needed...
#     # (they save typing the .content and converting to metavalues)
#     def __getitem__(self, i):
#         return self.content[i]
# 
#     def __setitem__(self, i, v):
#         self.content[i] = builtin2meta(v)
# 
#     def __contains__(self, i):
#         return i in self.content
# 
# class MetaString(MetaValue):
#     """
#     Text (a string)
# 
#     :param text: a string of unformatted text
#     :type text: :class:`str`
#     :Base: :class:`MetaValue`
#      """
#     # Note: this is the same as the Str class but with a MetaValue parent
# 
#     __slots__ = ['text']
# 
#     def __init__(self, text):
#         self.text = check_type(text, str)
# 
#     def __repr__(self):
#         return 'MetaString({})'.format(self.text)
# 
#     def _slots_to_json(self):
#         return self.text


# Path: tests/test_elements.py
import pytest
from panflute.elements import builtin2meta, MetaList, MetaMap, MetaString




class My_List(list):
    """Subclass for testing https://github.com/sergiocorreia/panflute/issues/166"""
    pass


class My_Dict(dict):
    """Subclass for testing https://github.com/sergiocorreia/panflute/issues/166"""
    pass


class Not_Builtin:
    pass


@pytest.mark.parametrize(
    "value,expect_type",
    [
        ([], MetaList),
        ({}, MetaMap),
        (My_List(), MetaList),
        (My_Dict(), MetaMap),

        (1, MetaString),