5858import mathics .builtin .drawing .plot as plot
5959from mathics .core .util import print_expression_tree
6060
61- # non-vectorized available, vectorized not available,
61+ # non-vectorized available, vectorized not available,
6262classic = [
6363 ("barchart" , "BarChart[{3,5,2,7}]" ),
6464 ("discreteplot" , "DiscretePlot[n^2,{n,1,10}]" ),
6565 ("histogram" , "Histogram[{1,1,1,5,5,7,8,8,8}]" ),
6666 ("listlineplot" , "ListLinePlot[{1,4,2,5,3}]" ),
6767 ("listplot" , "ListPlot[{1,4,2,5,3}]" ),
6868 ("liststepplot" , "ListStepPlot[{1,4,2,5,3}]" ),
69- #("manipulate", "Manipulate[Plot[a x,{x,0,1}],{a,0,5}]"),
69+ # ("manipulate", "Manipulate[Plot[a x,{x,0,1}],{a,0,5}]"),
7070 ("numberlineplot" , "NumberLinePlot[{1,3,4}]" ),
7171 ("parametricplot" , "ParametricPlot[{Cos[t],Sin[t]},{t,0,2 Pi}]" ),
7272 ("piechart" , "PieChart[{3,2,5}]" ),
105105
106106
107107def one_test (name , str_expr , vec , opt , act_dir = "/tmp" ):
108-
109108 # update name and set use_vectorized_plot depending on
110109 # whether vectorized test
111110 if vec :
@@ -136,7 +135,9 @@ def one_test(name, str_expr, vec, opt, act_dir="/tmp"):
136135
137136 # use diff to compare the actual result in act_fn to reference result in ref_fn
138137 ref_fn = os .path .join (ref_dir , f"{ name } .txt" )
139- result = subprocess .run (["diff" , "-U" , "5" , ref_fn , act_fn ], capture_output = False )
138+ result = subprocess .run (
139+ ["diff" , "-U" , "5" , ref_fn , act_fn ], capture_output = False
140+ )
140141 assert result .returncode == 0 , "reference and actual result differ"
141142 if act_fn != ref_fn :
142143 os .remove (act_fn )
@@ -146,17 +147,15 @@ def one_test(name, str_expr, vec, opt, act_dir="/tmp"):
146147
147148
148149def test_all (act_dir = "/tmp" , opt = None ):
150+ # run twice, once without and once with options
151+ for opt in [False , True ]:
152+ # run classic tests
153+ for name , str_expr in classic + both :
154+ one_test (name , str_expr , False , opt , act_dir )
149155
150- # run twice, once without and once with options
151- for opt in [False , True ]:
152-
153- # run classic tests
154- for name , str_expr in classic + both :
155- one_test (name , str_expr , False , opt , act_dir )
156-
157- # run vectorized tests
158- for name , str_expr in vectorized + both :
159- one_test (name , str_expr , True , opt , act_dir )
156+ # run vectorized tests
157+ for name , str_expr in vectorized + both :
158+ one_test (name , str_expr , True , opt , act_dir )
160159
161160
162161if __name__ == "__main__" :
@@ -171,5 +170,5 @@ def run_tests():
171170 except AssertionError :
172171 print ("FAIL" )
173172
174- #make_ref_files()
173+ # make_ref_files()
175174 run_tests ()
0 commit comments