@@ -50,6 +50,7 @@ class TestNodeTransformer:
50
50
("a + b" , "BinOp" , 1 ),
51
51
("a or b" , "BoolOp" , 1 ),
52
52
("[1,2]" , "List" , 1 ),
53
+ # set is xfailing right now
53
54
# ("{1,2}", "Set", 1),
54
55
# tuple eventually calls tracer.call but we've mocked out the whole thing
55
56
("(1,2)" , "Tuple" , 0 ),
@@ -59,6 +60,15 @@ class TestNodeTransformer:
59
60
("fn(*args)" , "Call" , 1 ),
60
61
("fn(*args)" , "Starred" , 1 ),
61
62
("fn(*args)" , "Name" , 1 ),
63
+ ("print(*'mystring')" , "Starred" , 1 ),
64
+ # calls tracer.trace_import but this list checks for tracer.call calls
65
+ ("import math" , "Import" , 0 ),
66
+ # calls tracer.trace_import but this list checks for tracer.call calls
67
+ # TODO - import from calls transform utils which should really be mocked out and
68
+ # tested on their own, in true spirit of unit testing
69
+ ("from math import sqrt" , "ImportFrom" , 0 ),
70
+ ("a, b = (1,2)" , "Assign" , 2 ),
71
+ ("lambda x: x + 10" , "Lambda" , 1 ),
62
72
]
63
73
64
74
# TODO pull out constant to handle 3.7 vs 3.9 etc
@@ -83,15 +93,26 @@ class TestNodeTransformer:
83
93
"call" ,
84
94
"starred" ,
85
95
"name" ,
96
+ "starred_str" ,
97
+ "import" ,
98
+ "import_from" ,
99
+ "assign_tuple" ,
100
+ "lambda" ,
86
101
]
87
102
88
103
if sys .version_info < (3 , 8 ):
89
104
basic_tests_list += (("10" , "Num" , 0 ),)
105
+ # extslice does not call tracer.call but it contains a slice node.
106
+ # that along with subscript will result in two calls
107
+ basic_tests_list += (("a[:,3]" , "ExtSlice" , 2 ),)
90
108
basic_test_ids += ["num" ]
109
+ basic_test_ids += ["extslice" ]
91
110
else :
92
111
# this will break with 3.7
93
112
basic_tests_list += (("10" , "Constant" , 0 ),)
113
+ basic_tests_list += (("a[:,3]" , "Slice" , 2 ),)
94
114
basic_test_ids += ["constant" ]
115
+ basic_test_ids += ["slice_with_ext" ]
95
116
96
117
basic_tests = ("code, visitor, call_count" , basic_tests_list )
97
118
0 commit comments