Skip to content

Commit 9dff5b6

Browse files
committed
update test reprs
1 parent c5c242b commit 9dff5b6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

emailer_lib/mjml/tests/test_core.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import pytest
22
from io import BytesIO
3+
from emailer_lib.ingress import mjml_to_intermediate_email
34
from emailer_lib.mjml._core import MJMLTag, TagAttrDict
45

56

@@ -89,10 +90,10 @@ def test_render_with_string_and_tag_children():
8990
assert "More text" in mjml_content
9091

9192

92-
def test_repr_returns_mjml():
93+
def test_repr_returns_simple_string():
9394
tag = MJMLTag("mj-text", content="Hello")
9495

95-
assert repr(tag) == tag._render_mjml()
96+
assert repr(tag) == "<MJMLTag(mj-text)>"
9697

9798

9899
def test_to_html_with_complete_mjml_document():
@@ -121,12 +122,14 @@ def test_to_html_warns_and_wraps_other_tags():
121122
assert "html" in html_result
122123

123124

124-
def test_repr_html_calls_to_html():
125+
def test_repr_html_returns_intermediate_email_repr_html():
125126
tag = MJMLTag("mjml", MJMLTag("mj-body"))
126127
html_from_repr = tag._repr_html_()
127-
html_from_method = tag.to_html()
128128

129-
assert html_from_repr == html_from_method
129+
# _repr_html_() should return the HTML representation from mjml_to_intermediate_email
130+
assert "<!doctype html" in html_from_repr.lower() or "<html" in html_from_repr
131+
assert isinstance(html_from_repr, str)
132+
assert html_from_repr == mjml_to_intermediate_email(tag)._repr_html_()
130133

131134

132135
def test_to_html_passes_kwargs_to_mjml2html():

0 commit comments

Comments
 (0)