# Path: draftjs_exporter/engines/html5lib.py
# class DOM_HTML5LIB(DOMEngine):
#     """
#     html5lib implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> Element:
#         if not attr:
#             attr = {}
# 
#         return soup.new_tag(type_, **attr)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> Element:
#         return BeautifulSoup(markup, "html5lib")
# 
#     @staticmethod
#     def append_child(elt: Element, child: Element) -> None:
#         elt.append(child)
# 
#     @staticmethod
#     def render(elt: Element) -> HTML:
#         return RENDER_RE.sub("", str(elt))
# 
#     @staticmethod
#     def render_debug(elt: Element) -> HTML:
#         return RENDER_DEBUG_RE.sub("", str(elt))
# 
# Path: draftjs_exporter/engines/lxml.py
# class DOM_LXML(DOMEngine):
#     """
#     lxml implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> etree.Element:
#         nsmap = None
# 
#         if attr:
#             if "xlink:href" in attr:
#                 attr[f"{{{NSMAP['xlink']}}}href"] = attr.pop("xlink:href")
#                 nsmap = NSMAP
# 
#         return etree.Element(type_, attrib=attr, nsmap=nsmap)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> etree.Element:
#         return html.fromstring(markup)
# 
#     @staticmethod
#     def append_child(elt: etree.Element, child: etree.Element) -> None:
#         if hasattr(child, "tag"):
#             elt.append(child)
#         else:
#             c = etree.Element("fragment")
#             c.text = child
#             elt.append(c)
# 
#     @staticmethod
#     def render(elt: etree.Element) -> HTML:
#         return RENDER_RE.sub(
#             "", etree.tostring(elt, method="html", encoding="unicode")
#         )
# 
#     @staticmethod
#     def render_debug(elt: etree.Element) -> HTML:
#         return etree.tostring(elt, method="html", encoding="unicode")
# 
# Path: draftjs_exporter/engines/string.py
# class DOMString(DOMEngine):
#     """
#     String concatenation implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> Elt:
#         return Elt(type_, attr)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> Elt:
#         """
#         Allows inserting arbitrary HTML into the exporter output.
#         Treats the HTML as if it had been escaped and was safe already.
#         """
#         return Elt.from_html(markup)
# 
#     @staticmethod
#     def append_child(elt: Elt, child: Elt) -> None:
#         # This check is necessary because the current wrapper_state implementation
#         # has an issue where it inserts elements multiple times.
#         # This must be skipped for text, which can be duplicated.
#         is_existing_ref = child in elt.children and isinstance(child, Elt)
#         if not is_existing_ref:
#             elt.children.append(child)
# 
#     @staticmethod
#     def render_attrs(attr: Attr) -> str:
#         attrs = [f' {k}="{escape(v)}"' for k, v in attr.items()]
#         return "".join(attrs)
# 
#     @staticmethod
#     def render_children(children: Sequence[Union[HTML, Elt]]) -> HTML:
#         return "".join(
#             [
#                 DOMString.render(c)
#                 if isinstance(c, Elt)
#                 else escape(c, quote=False)
#                 for c in children
#             ]
#         )
# 
#     @staticmethod
#     def render(elt: Elt) -> HTML:
#         type_ = elt.type
#         attr = DOMString.render_attrs(elt.attr) if elt.attr else ""
#         children = (
#             DOMString.render_children(elt.children) if elt.children else ""
#         )
# 
#         if type_ == "fragment":
#             return children
# 
#         if type_ in VOID_ELEMENTS:
#             return f"<{type_}{attr}/>"
# 
#         if type_ == "escaped_html":
#             return elt.markup  # type: ignore
# 
#         return f"<{type_}{attr}>{children}</{type_}>"
# 
#     @staticmethod
#     def render_debug(elt: Elt) -> HTML:
#         type_ = elt.type
#         attr = DOMString.render_attrs(elt.attr) if elt.attr else ""
#         children = (
#             DOMString.render_children(elt.children) if elt.children else ""
#         )
# 
#         if type_ in VOID_ELEMENTS:
#             return f"<{type_}{attr}/>"
# 
#         if type_ == "escaped_html":
#             return elt.markup  # type: ignore
# 
#         return f"<{type_}{attr}>{children}</{type_}>"


import unittest
from draftjs_exporter.engines.html5lib import DOM_HTML5LIB
from draftjs_exporter.engines.lxml import DOM_LXML
from draftjs_exporter.engines.string import DOMString
# -*- coding: utf-8 -*-



class TestDOMEnginesDifferences(unittest.TestCase):
    def test_html5lib_self_closing_tags(self):
        self.assertEqual(

# Path: draftjs_exporter/engines/html5lib.py
# class DOM_HTML5LIB(DOMEngine):
#     """
#     html5lib implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> Element:
#         if not attr:
#             attr = {}
# 
#         return soup.new_tag(type_, **attr)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> Element:
#         return BeautifulSoup(markup, "html5lib")
# 
#     @staticmethod
#     def append_child(elt: Element, child: Element) -> None:
#         elt.append(child)
# 
#     @staticmethod
#     def render(elt: Element) -> HTML:
#         return RENDER_RE.sub("", str(elt))
# 
#     @staticmethod
#     def render_debug(elt: Element) -> HTML:
#         return RENDER_DEBUG_RE.sub("", str(elt))
# 
# Path: draftjs_exporter/engines/lxml.py
# class DOM_LXML(DOMEngine):
#     """
#     lxml implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> etree.Element:
#         nsmap = None
# 
#         if attr:
#             if "xlink:href" in attr:
#                 attr[f"{{{NSMAP['xlink']}}}href"] = attr.pop("xlink:href")
#                 nsmap = NSMAP
# 
#         return etree.Element(type_, attrib=attr, nsmap=nsmap)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> etree.Element:
#         return html.fromstring(markup)
# 
#     @staticmethod
#     def append_child(elt: etree.Element, child: etree.Element) -> None:
#         if hasattr(child, "tag"):
#             elt.append(child)
#         else:
#             c = etree.Element("fragment")
#             c.text = child
#             elt.append(c)
# 
#     @staticmethod
#     def render(elt: etree.Element) -> HTML:
#         return RENDER_RE.sub(
#             "", etree.tostring(elt, method="html", encoding="unicode")
#         )
# 
#     @staticmethod
#     def render_debug(elt: etree.Element) -> HTML:
#         return etree.tostring(elt, method="html", encoding="unicode")
# 
# Path: draftjs_exporter/engines/string.py
# class DOMString(DOMEngine):
#     """
#     String concatenation implementation of the DOM API.
#     """
# 
#     @staticmethod
#     def create_tag(type_: Tag, attr: Optional[Attr] = None) -> Elt:
#         return Elt(type_, attr)
# 
#     @staticmethod
#     def parse_html(markup: HTML) -> Elt:
#         """
#         Allows inserting arbitrary HTML into the exporter output.
#         Treats the HTML as if it had been escaped and was safe already.
#         """
#         return Elt.from_html(markup)
# 
#     @staticmethod
#     def append_child(elt: Elt, child: Elt) -> None:
#         # This check is necessary because the current wrapper_state implementation
#         # has an issue where it inserts elements multiple times.
#         # This must be skipped for text, which can be duplicated.
#         is_existing_ref = child in elt.children and isinstance(child, Elt)
#         if not is_existing_ref:
#             elt.children.append(child)
# 
#     @staticmethod
#     def render_attrs(attr: Attr) -> str:
#         attrs = [f' {k}="{escape(v)}"' for k, v in attr.items()]
#         return "".join(attrs)
# 
#     @staticmethod
#     def render_children(children: Sequence[Union[HTML, Elt]]) -> HTML:
#         return "".join(
#             [
#                 DOMString.render(c)
#                 if isinstance(c, Elt)
#                 else escape(c, quote=False)
#                 for c in children
#             ]
#         )
# 
#     @staticmethod
#     def render(elt: Elt) -> HTML:
#         type_ = elt.type
#         attr = DOMString.render_attrs(elt.attr) if elt.attr else ""
#         children = (
#             DOMString.render_children(elt.children) if elt.children else ""
#         )
# 
#         if type_ == "fragment":
#             return children
# 
#         if type_ in VOID_ELEMENTS:
#             return f"<{type_}{attr}/>"
# 
#         if type_ == "escaped_html":
#             return elt.markup  # type: ignore
# 
#         return f"<{type_}{attr}>{children}</{type_}>"
# 
#     @staticmethod
#     def render_debug(elt: Elt) -> HTML:
#         type_ = elt.type
#         attr = DOMString.render_attrs(elt.attr) if elt.attr else ""
#         children = (
#             DOMString.render_children(elt.children) if elt.children else ""
#         )
# 
#         if type_ in VOID_ELEMENTS:
#             return f"<{type_}{attr}/>"
# 
#         if type_ == "escaped_html":
#             return elt.markup  # type: ignore
# 
#         return f"<{type_}{attr}>{children}</{type_}>"


# Path: tests/engines/test_engines_differences.py
import unittest
from draftjs_exporter.engines.html5lib import DOM_HTML5LIB
from draftjs_exporter.engines.lxml import DOM_LXML
from draftjs_exporter.engines.string import DOMString

# -*- coding: utf-8 -*-



class TestDOMEnginesDifferences(unittest.TestCase):
    def test_html5lib_self_closing_tags(self):
        self.assertEqual(

            DOM_HTML5LIB.render_debug(DOM_HTML5LIB.create_tag("hr")), "<hr/>"