@@ -148,7 +148,7 @@ def Child():
148148 child_set_state .current (1 )
149149 path , changes = await render_json_patch (layout )
150150
151- assert path == "/children/1"
151+ assert path == "/children/0/children/ 1"
152152 assert changes == [
153153 {"op" : "replace" , "path" : "/children/0/children/0" , "value" : "1" }
154154 ]
@@ -225,21 +225,31 @@ def BadChild():
225225 assert_same_items (
226226 patch .changes ,
227227 [
228- {"op" : "add" , "path" : "/tagName" , "value" : "" },
229228 {
230229 "op" : "add" ,
231230 "path" : "/children" ,
232231 "value" : [
233232 {
234233 "children" : [
235- {"children" : [...], "tagName" : "" },
234+ {
235+ "children" : [
236+ {"children" : ["hello" ], "tagName" : "div" }
237+ ],
238+ "tagName" : "" ,
239+ },
236240 {"error" : "" , "tagName" : "" },
237- {"children" : [...], "tagName" : "" },
241+ {
242+ "children" : [
243+ {"children" : ["hello" ], "tagName" : "div" }
244+ ],
245+ "tagName" : "" ,
246+ },
238247 ],
239248 "tagName" : "div" ,
240249 }
241250 ],
242251 },
252+ {"op" : "add" , "path" : "/tagName" , "value" : "" },
243253 ],
244254 )
245255
@@ -598,9 +608,14 @@ def Inner():
598608 {
599609 "op" : "add" ,
600610 "path" : "/children" ,
601- "value" : [{"children" : ["hello" ], "tagName" : "div" }],
611+ "value" : [
612+ {
613+ "children" : [{"children" : ["hello" ], "tagName" : "div" }],
614+ "tagName" : "" ,
615+ }
616+ ],
602617 },
603- {"op" : "add" , "path" : "/tagName" , "value" : "div " },
618+ {"op" : "add" , "path" : "/tagName" , "value" : "" },
604619 ],
605620 )
606621
@@ -685,18 +700,31 @@ def HasNestedEventHandler():
685700
686701
687702async def test_duplicate_sibling_keys_causes_error (caplog ):
703+ hook = HookCatcher ()
704+
688705 @idom .component
706+ @hook .capture
689707 def ComponentReturnsDuplicateKeys ():
690708 return idom .html .div (
691- idom .html .div (key = "duplicate" ), idom .html .div (key = "duplicate" )
709+ idom .html .div (key = "duplicate" ),
710+ idom .html .div (key = "duplicate" ),
692711 )
693712
694- with assert_idom_logged (
695- error_type = ValueError ,
696- match_error = r"Duplicate keys \['duplicate'\] at '/'" ,
697- clear_matched_records = True ,
698- ):
699- with idom .Layout (ComponentReturnsDuplicateKeys ()) as layout :
713+ with idom .Layout (ComponentReturnsDuplicateKeys ()) as layout :
714+ with assert_idom_logged (
715+ error_type = ValueError ,
716+ match_error = r"Duplicate keys \['duplicate'\] at '/children/0'" ,
717+ clear_matched_records = True ,
718+ ):
719+ await layout .render ()
720+
721+ hook .latest .schedule_render ()
722+
723+ with assert_idom_logged (
724+ error_type = ValueError ,
725+ match_error = r"Duplicate keys \['duplicate'\] at '/children/0'" ,
726+ clear_matched_records = True ,
727+ ):
700728 await layout .render ()
701729
702730
0 commit comments