33independent_data = {
44 "text" : [
55 "pre" ,
6- { "independent" : [
7- "a" ,
8- {
9- "def" : "a_post" ,
10- "data" : "${pdl_context}" ,
11- "contribute" : []
12- },
13- "b" ,
14- {
15- "def" : "b_post" ,
16- "data" : "${pdl_context}" ,
17- "contribute" : []
18- },
6+ {
7+ "independent" : [
8+ "a" ,
9+ {"def" : "a_post" , "data" : "${pdl_context}" , "contribute" : []},
10+ "b" ,
11+ {"def" : "b_post" , "data" : "${pdl_context}" , "contribute" : []},
1912 ]
2013 },
2114 "post" ,
22- {
23- "def" : "post_post" ,
24- "data" : "${pdl_context}" ,
25- "contribute" : []
26- },
15+ {"def" : "post_post" , "data" : "${pdl_context}" , "contribute" : []},
2716 ]
2817}
2918
19+
3020def test_independent_data ():
3121 result = exec_dict (independent_data , output = "all" )
32- assert result ["scope" ]["a_post" ] == [{"role" : "user" , "content" : "pre" , "defsite" : "text.0" }]
33- assert result ["scope" ]["b_post" ] == [{"role" : "user" , "content" : "pre" , "defsite" : "text.0" }]
34- assert result ["scope" ]["post_post" ] == [{"role" : "user" , "content" : "pre" , "defsite" : "text.0" },
35- {"role" : "user" , "content" : "a" , "defsite" : "text.1.independent.0" },
36- {"role" : "user" , "content" : "b" , "defsite" : "text.1.independent.2" },
37- {"role" : "user" , "content" : "post" , "defsite" : "text.2" }]
22+ assert result ["scope" ]["a_post" ] == [
23+ {"role" : "user" , "content" : "pre" , "defsite" : "text.0" }
24+ ]
25+ assert result ["scope" ]["b_post" ] == [
26+ {"role" : "user" , "content" : "pre" , "defsite" : "text.0" }
27+ ]
28+ assert result ["scope" ]["post_post" ] == [
29+ {"role" : "user" , "content" : "pre" , "defsite" : "text.0" },
30+ {"role" : "user" , "content" : "a" , "defsite" : "text.1.independent.0" },
31+ {"role" : "user" , "content" : "b" , "defsite" : "text.1.independent.2" },
32+ {"role" : "user" , "content" : "post" , "defsite" : "text.2" },
33+ ]
34+
3835
3936for_data = {
40- "defs" : {
41- "list" : {
42- "data" : ["a" , "b" ]
43- }
44- },
45- "for" : {
46- "elem" : "${list}"
47- },
37+ "defs" : {"list" : {"data" : ["a" , "b" ]}},
38+ "for" : {"elem" : "${list}" },
4839 "repeat" : {
4940 "text" : [
5041 "${elem}" ,
51- {
52- "def" : "context" ,
53- "data" : "${pdl_context}" ,
54- "contribute" : []
55- }
56-
42+ {"def" : "context" , "data" : "${pdl_context}" , "contribute" : []},
5743 ]
5844 },
59- "join" : {
60- "as" : "independent"
61- }
62-
45+ "join" : {"as" : "independent" },
6346}
6447
48+
6549def test_for_data ():
6650 result = exec_dict (for_data , output = "all" )
6751 assert result ["scope" ]["context" ] == [
68- {
69- ' content' : 'b' ,
70- ' defsite' : ' repeat.1.text.0' ,
71- ' role' : ' user' ,
72- },
73- ]
52+ {
53+ " content" : "b" ,
54+ " defsite" : " repeat.1.text.0" ,
55+ " role" : " user" ,
56+ },
57+ ]
0 commit comments