@@ -88,8 +88,8 @@ def test_ref_repr():
8888 },
8989 ],
9090)
91- def test_html_to_vdom (case ):
92- assert utils .html_to_vdom (case ["source" ]) == case ["model" ]
91+ def test_string_to_reactpy (case ):
92+ assert utils .string_to_reactpy (case ["source" ]) == case ["model" ]
9393
9494
9595@pytest .mark .parametrize (
@@ -192,18 +192,18 @@ def test_html_to_vdom(case):
192192 },
193193 ],
194194)
195- def test_html_to_vdom_default_transforms (case ):
196- assert utils .html_to_vdom (case ["source" ]) == case ["model" ]
195+ def test_string_to_reactpy_default_transforms (case ):
196+ assert utils .string_to_reactpy (case ["source" ]) == case ["model" ]
197197
198198
199- def test_html_to_vdom_intercept_links ():
199+ def test_string_to_reactpy_intercept_links ():
200200 source = '<a href="https://example.com">Hello World</a>'
201201 expected = {
202202 "tagName" : "a" ,
203203 "children" : ["Hello World" ],
204204 "attributes" : {"href" : "https://example.com" },
205205 }
206- result = utils .html_to_vdom (source , intercept_links = True )
206+ result = utils .string_to_reactpy (source , intercept_links = True )
207207
208208 # Check if the result equals expected when removing `eventHandlers` from the result dict
209209 event_handlers = result .pop ("eventHandlers" , {})
@@ -213,7 +213,7 @@ def test_html_to_vdom_intercept_links():
213213 assert "onClick" in event_handlers
214214
215215
216- def test_html_to_vdom_custom_transform ():
216+ def test_string_to_reactpy_custom_transform ():
217217 source = "<p>hello <a>world</a> and <a>universe</a>lmao</p>"
218218
219219 def make_links_blue (node ):
@@ -241,7 +241,8 @@ def make_links_blue(node):
241241 }
242242
243243 assert (
244- utils .html_to_vdom (source , make_links_blue , intercept_links = False ) == expected
244+ utils .string_to_reactpy (source , make_links_blue , intercept_links = False )
245+ == expected
245246 )
246247
247248
@@ -256,10 +257,10 @@ def test_non_html_tag_behavior():
256257 ],
257258 }
258259
259- assert utils .html_to_vdom (source , strict = False ) == expected
260+ assert utils .string_to_reactpy (source , strict = False ) == expected
260261
261262 with pytest .raises (utils .HTMLParseError ):
262- utils .html_to_vdom (source , strict = True )
263+ utils .string_to_reactpy (source , strict = True )
263264
264265
265266SOME_OBJECT = object ()
@@ -342,19 +343,23 @@ def example_child():
342343 html .div (example_parent ()),
343344 '<div><div id="sample" style="padding:15px"><h1>Sample Application</h1></div></div>' ,
344345 ),
346+ (
347+ example_parent (),
348+ '<div id="sample" style="padding:15px"><h1>Sample Application</h1></div>' ,
349+ ),
345350 (
346351 html .form ({"acceptCharset" : "utf-8" }),
347352 '<form accept-charset="utf-8"></form>' ,
348353 ),
349354 ],
350355)
351- def test_vdom_to_html (vdom_in , html_out ):
352- assert utils .vdom_to_html (vdom_in ) == html_out
356+ def test_reactpy_to_string (vdom_in , html_out ):
357+ assert utils .reactpy_to_string (vdom_in ) == html_out
353358
354359
355- def test_vdom_to_html_error ():
360+ def test_reactpy_to_string_error ():
356361 with pytest .raises (TypeError , match = "Expected a VDOM dict" ):
357- utils .vdom_to_html ({"notVdom" : True })
362+ utils .reactpy_to_string ({"notVdom" : True })
358363
359364
360365def test_invalid_dotted_path ():
0 commit comments