# Path: email_parser/renderer.py
# def _md_to_html(text, base_url=None):
# def _split_subject(placeholders):
# def _transform_extended_tags(content):
#     def __init__(self, template, email_locale):
#     def _inline_css(self, html, css):
#     def _wrap_with_text_direction(self, html):
#     def _wrap_with_highlight(self, html, highlight):
#     def _render_placeholder(self, placeholder, variant=None, highlight=None):
#     def _concat_parts(self, subject, parts, variant):
#     def render(self, placeholders, variant=None, highlight=None):
#     def __init__(self, template, email_locale):
#     def _html_to_text(self, html):
#     def _md_to_text(self, text, base_url=None):
#     def render(self, placeholders, variant=None):
#     def render(self, placeholders, variant=None):
# def render(email_locale, template, placeholders, variant=None, highlight=None):
# class HtmlRenderer(object):
# class TextRenderer(object):
# class SubjectRenderer(object):
# 
# Path: email_parser/const.py
# SUBJECT_EXTENSION = '.subject'
# TEXT_EXTENSION = '.text'
# HTML_EXTENSION = '.html'
# CSS_EXTENSION = '.css'
# SOURCE_EXTENSION = '.xml'
# SUBJECT_PLACEHOLDER = 'subject'
# GLOBALS_EMAIL_NAME = 'global'
# GLOBALS_PLACEHOLDER_PREFIX = 'global_'
# REPO_SRC_PATH = 'src'
# PLACEHOLDERS_FILENAME = 'placeholders_config.json'
# INLINE_TEXT_PATTERN = r'\[{2}(.+)\]{2}'
# IMAGE_PATTERN = '![{}]({}/{})'
# SEGMENT_REGEX = r'\<string[^>]*>'
# SEGMENT_NAME_REGEX = r' name="([^"]+)"'
# TEXT_EMAIL_PLACEHOLDER_SEPARATOR = '\n\n'
# HTML_PARSER = 'lxml'
# LOCALE_PLACEHOLDER = '{link_locale}'
# DEFAULT_LOCALE = 'en'
# DEFAULT_WORKER_POOL = 10
# JSON_INDENT = 4
# 
# Path: email_parser/config.py
# def init(*,
#          _paths=_default_paths,
#          _pattern=_default_pattern,
#          _base_img_path=_default_base_img_path,
#          _rtl_locales=_default_rtl,
#          _lang_mappings=_default_lang_mappings):


from unittest import TestCase
from unittest.mock import patch
from email_parser.model import *
from email_parser import renderer, const, config
    def setUp(self):
        self.r = renderer.SubjectRenderer()
        self.placeholders = {
            'content': Placeholder('content', 'dummy content'),
            'subject': Placeholder('subject', 'dummy subject', variants={'B': 'experiment subject'})
        }

    def test_happy_path(self):
        actual = self.r.render(self.placeholders)
        self.assertEqual('dummy subject', actual)

    def test_variant(self):
        actual = self.r.render(self.placeholders, variant='B')
        self.assertEqual('experiment subject', actual)

    def test_raise_error_for_missing_subject(self):
        placeholders = {'content': 'dummy content'}
        with self.assertRaises(MissingSubjectError):
            self.r.render(placeholders)


class TestHtmlRenderer(TestCase):
    def _get_renderer(self, template_html, template_placeholders, **kwargs):
        template = Template(
            name='template_name',
            styles_names=['template_style.css', 'template_style2.css'],
            styles='',
            content=template_html,
            placeholders=template_placeholders,
            type=None)

# Path: email_parser/renderer.py
# def _md_to_html(text, base_url=None):
# def _split_subject(placeholders):
# def _transform_extended_tags(content):
#     def __init__(self, template, email_locale):
#     def _inline_css(self, html, css):
#     def _wrap_with_text_direction(self, html):
#     def _wrap_with_highlight(self, html, highlight):
#     def _render_placeholder(self, placeholder, variant=None, highlight=None):
#     def _concat_parts(self, subject, parts, variant):
#     def render(self, placeholders, variant=None, highlight=None):
#     def __init__(self, template, email_locale):
#     def _html_to_text(self, html):
#     def _md_to_text(self, text, base_url=None):
#     def render(self, placeholders, variant=None):
#     def render(self, placeholders, variant=None):
# def render(email_locale, template, placeholders, variant=None, highlight=None):
# class HtmlRenderer(object):
# class TextRenderer(object):
# class SubjectRenderer(object):
# 
# Path: email_parser/const.py
# SUBJECT_EXTENSION = '.subject'
# TEXT_EXTENSION = '.text'
# HTML_EXTENSION = '.html'
# CSS_EXTENSION = '.css'
# SOURCE_EXTENSION = '.xml'
# SUBJECT_PLACEHOLDER = 'subject'
# GLOBALS_EMAIL_NAME = 'global'
# GLOBALS_PLACEHOLDER_PREFIX = 'global_'
# REPO_SRC_PATH = 'src'
# PLACEHOLDERS_FILENAME = 'placeholders_config.json'
# INLINE_TEXT_PATTERN = r'\[{2}(.+)\]{2}'
# IMAGE_PATTERN = '![{}]({}/{})'
# SEGMENT_REGEX = r'\<string[^>]*>'
# SEGMENT_NAME_REGEX = r' name="([^"]+)"'
# TEXT_EMAIL_PLACEHOLDER_SEPARATOR = '\n\n'
# HTML_PARSER = 'lxml'
# LOCALE_PLACEHOLDER = '{link_locale}'
# DEFAULT_LOCALE = 'en'
# DEFAULT_WORKER_POOL = 10
# JSON_INDENT = 4
# 
# Path: email_parser/config.py
# def init(*,
#          _paths=_default_paths,
#          _pattern=_default_pattern,
#          _base_img_path=_default_base_img_path,
#          _rtl_locales=_default_rtl,
#          _lang_mappings=_default_lang_mappings):


# Path: tests/test_renderer.py
from unittest import TestCase
from unittest.mock import patch
from email_parser.model import *
from email_parser import renderer, const, config

    def setUp(self):
        self.r = renderer.SubjectRenderer()
        self.placeholders = {
            'content': Placeholder('content', 'dummy content'),
            'subject': Placeholder('subject', 'dummy subject', variants={'B': 'experiment subject'})
        }

    def test_happy_path(self):
        actual = self.r.render(self.placeholders)
        self.assertEqual('dummy subject', actual)

    def test_variant(self):
        actual = self.r.render(self.placeholders, variant='B')
        self.assertEqual('experiment subject', actual)

    def test_raise_error_for_missing_subject(self):
        placeholders = {'content': 'dummy content'}
        with self.assertRaises(MissingSubjectError):
            self.r.render(placeholders)


class TestHtmlRenderer(TestCase):
    def _get_renderer(self, template_html, template_placeholders, **kwargs):
        template = Template(
            name='template_name',
            styles_names=['template_style.css', 'template_style2.css'],
            styles='',
            content=template_html,
            placeholders=template_placeholders,
            type=None)

        return renderer.HtmlRenderer(template, kwargs.get('email_locale', const.DEFAULT_LOCALE))