@@ -221,7 +221,7 @@ def test_visit_setcomp(code: str, latex: str) -> None:
221
221
],
222
222
)
223
223
def test_visit_call_sum_prod (src_suffix : str , dest_suffix : str ) -> None :
224
- for src_fn , dest_fn in [("sum" , r"\sum" ), ("math. prod" , r"\prod" )]:
224
+ for src_fn , dest_fn in [("sum" , r"\sum" ), ("prod" , r"\prod" )]:
225
225
node = ast .parse (src_fn + src_suffix ).body [0 ].value
226
226
assert isinstance (node , ast .Call )
227
227
assert FunctionCodegen ().visit (node ) == dest_fn + dest_suffix
@@ -243,12 +243,12 @@ def test_visit_call_sum_prod(src_suffix: str, dest_suffix: str) -> None:
243
243
),
244
244
# 3 clauses
245
245
(
246
- "math. prod(i for y in x for i in y)" ,
246
+ "prod(i for y in x for i in y)" ,
247
247
r"\prod_{y \in x}^{} \prod_{i \in y}^{} "
248
248
r"\mathopen{}\left({i}\mathclose{}\right)" ,
249
249
),
250
250
(
251
- "math. prod(i for y in x for z in y for i in z)" ,
251
+ "prod(i for y in x for z in y for i in z)" ,
252
252
r"\prod_{y \in x}^{} \prod_{z \in y}^{} \prod_{i \in z}^{} "
253
253
r"\mathopen{}\left({i}\mathclose{}\right)" ,
254
254
),
@@ -258,7 +258,7 @@ def test_visit_call_sum_prod(src_suffix: str, dest_suffix: str) -> None:
258
258
r"\sum_{i = {0}}^{{n}} \mathopen{}\left({i}\mathclose{}\right)" ,
259
259
),
260
260
(
261
- "math. prod(i for i in range(n-1))" ,
261
+ "prod(i for i in range(n-1))" ,
262
262
r"\prod_{i = {0}}^{{n - {2}}} \mathopen{}\left({i}\mathclose{}\right)" ,
263
263
),
264
264
# reduce stop parameter
@@ -267,7 +267,7 @@ def test_visit_call_sum_prod(src_suffix: str, dest_suffix: str) -> None:
267
267
r"\sum_{i = {0}}^{{n}} \mathopen{}\left({i}\mathclose{}\right)" ,
268
268
),
269
269
(
270
- "math. prod(i for i in range(n-1))" ,
270
+ "prod(i for i in range(n-1))" ,
271
271
r"\prod_{i = {0}}^{{n - {2}}} \mathopen{}\left({i}\mathclose{}\right)" ,
272
272
),
273
273
],
@@ -298,7 +298,7 @@ def test_visit_call_sum_prod_multiple_comprehension(code: str, latex: str) -> No
298
298
],
299
299
)
300
300
def test_visit_call_sum_prod_with_if (src_suffix : str , dest_suffix : str ) -> None :
301
- for src_fn , dest_fn in [("sum" , r"\sum" ), ("math. prod" , r"\prod" )]:
301
+ for src_fn , dest_fn in [("sum" , r"\sum" ), ("prod" , r"\prod" )]:
302
302
node = ast .parse (src_fn + src_suffix ).body [0 ].value
303
303
assert isinstance (node , ast .Call )
304
304
assert FunctionCodegen ().visit (node ) == dest_fn + dest_suffix
@@ -707,7 +707,7 @@ def test_visit_constant(code: str, latex: str) -> None:
707
707
("x[0][1]" , "{x_{{0}, {1}}}" ),
708
708
("x[0][1][2]" , "{x_{{0}, {1}, {2}}}" ),
709
709
("x[foo]" , "{x_{foo}}" ),
710
- ("x[math. floor(x)]" , r"{x_{\left\lfloor{x}\right\rfloor}}" ),
710
+ ("x[floor(x)]" , r"{x_{\left\lfloor{x}\right\rfloor}}" ),
711
711
],
712
712
)
713
713
def test_visit_subscript (code : str , latex : str ) -> None :
0 commit comments