@@ -9,54 +9,81 @@ def test_params_axis():
99 """
1010 Test the Axis class.
1111 """
12- assert str (Axis (annotation = 1 , tick = 0.5 )) == "a1f0.5"
13- assert str (Axis (annotation = 1 , tick = 0.5 , angle = 30 )) == "a1f0.5+a30"
14- assert (
15- str (Axis (annotation = 1 , tick = 0.5 , angle = 30 , skip_edge = "left" )) == "a1f0.5+a30+el"
16- )
17- assert str (Axis (annotation = 1 , tick = 0.5 , fancy = True )) == "a1f0.5+f"
18- assert str (Axis (annotation = 1 , tick = 0.5 , label = "My Label" )) == "a1f0.5+lMy Label"
19- assert str (Axis (annotation = 1 , tick = 0.5 , hlabel = "My HLabel" )) == "a1f0.5+LMy HLabel"
20- assert (
21- str (Axis (annotation = 1 , tick = 0.5 , alt_label = "Alt Label" )) == "a1f0.5+sAlt Label"
22- )
23- assert (
24- str (Axis (annotation = 1 , tick = 0.5 , alt_hlabel = "Alt HLabel" ))
25- == "a1f0.5+SAlt HLabel"
12+ assert str (Axis (annotation = True )) == "a"
13+ assert str (Axis (annotation = True , tick = True , grid = True )) == "afg"
14+ assert str (Axis (annotation = 1 , tick = 0.5 , grid = 0.1 )) == "a1f0.5g0.1"
15+
16+ assert str (Axis (annotation = 1 , angle = 30 )) == "a1+a30"
17+ assert str (Axis (annotation = 1 , angle = 30 , skip_edge = "left" )) == "a1+a30+el"
18+ assert str (Axis (annotation = 1 , fancy = True )) == "a1+f"
19+ assert str (Axis (annotation = 1 , label = "My Label" )) == "a1+lMy Label"
20+ assert str (Axis (annotation = 1 , hlabel = "My HLabel" )) == "a1+LMy HLabel"
21+ assert str (Axis (annotation = 1 , alt_label = "Alt Label" )) == "a1+sAlt Label"
22+ assert str (Axis (annotation = 1 , alt_hlabel = "Alt HLabel" )) == "a1+SAlt HLabel"
23+ assert str (Axis (annotation = 1 , prefix = "$" )) == "a1+p$"
24+ assert str (Axis (annotation = 1 , unit = "km" )) == "a1+ukm"
25+
26+ axis = Axis (
27+ annotation = 1 ,
28+ tick = 0.5 ,
29+ grid = 0.1 ,
30+ angle = 45 ,
31+ skip_edge = "right" ,
32+ fancy = True ,
33+ label = "Label" ,
34+ hlabel = "HLabel" ,
35+ alt_label = "AltLabel" ,
36+ alt_hlabel = "AltHLabel" ,
37+ prefix = "$" ,
38+ unit = "m" ,
2639 )
27- assert str (Axis ( annotation = 1 , tick = 0.5 , unit = "km" )) == "a1f0.5+ukm "
40+ assert str (axis ) == "a1f0.5g0.1+a45+er+f+lLabel+LHLabel+sAltLabel+SAltHLabel+p$+um "
2841
2942
3043def test_params_frame ():
3144 """
3245 Test the Frame class.
3346 """
34- frame = Frame (axes = "WSen" )
35- assert str (frame ) == "WSen"
36-
37- frame = Frame (title = "My Plot Title" )
38- assert str (frame ) == "+tMy Plot Title"
39-
40- frame = Frame (subtitle = "My Subtitle" )
41- assert str (frame ) == "+sMy Subtitle"
42-
43- frame = Frame (fill = "red" )
44- assert str (frame ) == "+gred"
45-
46- frame = Frame (fill = "lightblue" , title = "Plot Title" , subtitle = "My Subtitle" )
47- assert str (frame ) == "+glightblue+tPlot Title+sMy Subtitle"
47+ # Test individual parameters of the Axes part.
48+ assert str (Frame (axes = "WSen" )) == "WSen"
49+ assert str (Frame (fill = "red" )) == "+gred"
50+ assert str (Frame (title = "My Plot Title" )) == "+tMy Plot Title"
51+ assert str (Frame (subtitle = "My Subtitle" )) == "+sMy Subtitle"
52+ assert str (Frame (box = True )) == "+b"
53+ assert str (Frame (pen = "thick" )) == "+wthick"
54+ assert str (Frame (yzfill = "blue" )) == "+yblue"
55+ assert str (Frame (xzfill = "green" )) == "+xgreen"
56+ assert str (Frame (xyfill = "yellow" )) == "+zyellow"
57+ assert str (Frame (pole = [30 , - 90 ])) == "+o30/-90"
4858
59+ # Test all parameters of the Axes part.
4960 frame = Frame (
50- axes = "WSen" , fill = "lightblue" , title = "Plot Title" , subtitle = "My Subtitle"
61+ axes = "lrtb" ,
62+ fill = "lightblue" ,
63+ title = "Plot Title" ,
64+ subtitle = "My Subtitle" ,
65+ box = True ,
66+ pen = "1p,blue" ,
67+ yzfill = "pink" ,
68+ xzfill = "orange" ,
69+ xyfill = "purple" ,
70+ pole = ["45N" , "100W" ],
5171 )
52- assert str (frame ) == "WSen+glightblue+tPlot Title+sMy Subtitle"
53-
54- frame = Frame (
55- x = Axis (annotation = 1 , tick = 0.5 ), y = Axis (label = "Y Axis" ), title = "Plot Title"
72+ assert str (frame ) == (
73+ "lrtb+glightblue+tPlot Title+sMy Subtitle+b+w1p,blue+ypink+xorange+zpurple+o45N/100W"
5674 )
57- assert list (frame ) == ["xa1f0.5" , "y+lY Axis" , "+tPlot Title" ]
5875
76+ # Test Frame with Axis parameters.
77+ frame = Frame (axis = Axis (annotation = True , tick = True ))
78+ assert str (frame ) == "af"
79+ frame = Frame (axis = Axis (annotation = 1 , tick = 0.5 , label = "Y Axis" ), title = "Plot Title" )
80+ assert str (frame ) == "a1f0.5+lY Axis+tPlot Title"
81+
82+ # Test Frame with separate Axis for x and y axes.
5983 frame = Frame (
60- axis = Axis (annotation = 1 , tick = 0.5 , label = "Label" , angle = 30 ), title = "Plot Title"
84+ x = Axis (annotation = 1 , tick = 0.5 , label = "X Axis" ),
85+ y = Axis (annotation = True , tick = True , label = "Y Axis" ),
86+ axes = "WSen" ,
87+ title = "Plot Title" ,
6188 )
62- assert list (frame ) == ["a1f0 .5+a30+lLabel " , "+tPlot Title" ]
89+ assert list (frame ) == ["xa1f0 .5+lX Axis" , "yaf+lY Axis " , "WSen +tPlot Title" ]
0 commit comments