@@ -49,135 +49,135 @@ pub(crate) fn set_context(expr: Expr, ctx: ExprContext) -> Expr {
4949
5050#[ cfg( test) ]
5151mod tests {
52- use crate :: parser :: parse_program ;
52+ use crate :: { ast , Parse } ;
5353
5454 #[ test]
5555 fn test_assign_name ( ) {
5656 let source = "x = (1, 2, 3)" ;
57- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
57+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
5858 insta:: assert_debug_snapshot!( parse_ast) ;
5959 }
6060
6161 #[ test]
6262 fn test_assign_tuple ( ) {
6363 let source = "(x, y) = (1, 2, 3)" ;
64- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
64+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
6565 insta:: assert_debug_snapshot!( parse_ast) ;
6666 }
6767
6868 #[ test]
6969 #[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
7070 fn test_assign_list ( ) {
7171 let source = "[x, y] = (1, 2, 3)" ;
72- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
72+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
7373 insta:: assert_debug_snapshot!( parse_ast) ;
7474 }
7575
7676 #[ test]
7777 fn test_assign_attribute ( ) {
7878 let source = "x.y = (1, 2, 3)" ;
79- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
79+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
8080 insta:: assert_debug_snapshot!( parse_ast) ;
8181 }
8282
8383 #[ test]
8484 fn test_assign_subscript ( ) {
8585 let source = "x[y] = (1, 2, 3)" ;
86- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
86+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
8787 insta:: assert_debug_snapshot!( parse_ast) ;
8888 }
8989
9090 #[ test]
9191 fn test_assign_starred ( ) {
9292 let source = "(x, *y) = (1, 2, 3)" ;
93- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
93+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
9494 insta:: assert_debug_snapshot!( parse_ast) ;
9595 }
9696
9797 #[ test]
9898 fn test_assign_for ( ) {
9999 let source = "for x in (1, 2, 3): pass" ;
100- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
100+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
101101 insta:: assert_debug_snapshot!( parse_ast) ;
102102 }
103103
104104 #[ test]
105105 #[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
106106 fn test_assign_list_comp ( ) {
107107 let source = "x = [y for y in (1, 2, 3)]" ;
108- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
108+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
109109 insta:: assert_debug_snapshot!( parse_ast) ;
110110 }
111111
112112 #[ test]
113113 #[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
114114 fn test_assign_set_comp ( ) {
115115 let source = "x = {y for y in (1, 2, 3)}" ;
116- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
116+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
117117 insta:: assert_debug_snapshot!( parse_ast) ;
118118 }
119119
120120 #[ test]
121121 #[ cfg( not( feature = "all-nodes-with-ranges" ) ) ]
122122 fn test_assign_with ( ) {
123123 let source = "with 1 as x: pass" ;
124- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
124+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
125125 insta:: assert_debug_snapshot!( parse_ast) ;
126126 }
127127
128128 #[ test]
129129 fn test_assign_named_expr ( ) {
130130 let source = "if x:= 1: pass" ;
131- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
131+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
132132 insta:: assert_debug_snapshot!( parse_ast) ;
133133 }
134134
135135 #[ test]
136136 fn test_ann_assign_name ( ) {
137137 let source = "x: int = 1" ;
138- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
138+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
139139 insta:: assert_debug_snapshot!( parse_ast) ;
140140 }
141141
142142 #[ test]
143143 fn test_aug_assign_name ( ) {
144144 let source = "x += 1" ;
145- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
145+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
146146 insta:: assert_debug_snapshot!( parse_ast) ;
147147 }
148148
149149 #[ test]
150150 fn test_aug_assign_attribute ( ) {
151151 let source = "x.y += (1, 2, 3)" ;
152- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
152+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
153153 insta:: assert_debug_snapshot!( parse_ast) ;
154154 }
155155
156156 #[ test]
157157 fn test_aug_assign_subscript ( ) {
158158 let source = "x[y] += (1, 2, 3)" ;
159- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
159+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
160160 insta:: assert_debug_snapshot!( parse_ast) ;
161161 }
162162
163163 #[ test]
164164 fn test_del_name ( ) {
165165 let source = "del x" ;
166- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
166+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
167167 insta:: assert_debug_snapshot!( parse_ast) ;
168168 }
169169
170170 #[ test]
171171 fn test_del_attribute ( ) {
172172 let source = "del x.y" ;
173- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
173+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
174174 insta:: assert_debug_snapshot!( parse_ast) ;
175175 }
176176
177177 #[ test]
178178 fn test_del_subscript ( ) {
179179 let source = "del x[y]" ;
180- let parse_ast = parse_program ( source, "<test>" ) . unwrap ( ) ;
180+ let parse_ast = ast :: Suite :: parse ( source, "<test>" ) . unwrap ( ) ;
181181 insta:: assert_debug_snapshot!( parse_ast) ;
182182 }
183183}
0 commit comments