@@ -134,12 +134,29 @@ def test_random_colour(self):
134
134
self .assertLessEqual (g , 1.0 )
135
135
self .assertLessEqual (b , 1.0 )
136
136
137
- class ScaleConstant (unittest .TestCase ):
137
+ class TestScaleConstant (unittest .TestCase ):
138
138
def test_scale_constant (self ):
139
139
scale = rplot .ScaleConstant (1.0 )
140
140
self .assertEqual (scale (None , None ), 1.0 )
141
141
scale = rplot .ScaleConstant ("test" )
142
142
self .assertEqual (scale (None , None ), "test" )
143
143
144
+ class TestScaleSize (unittest .TestCase ):
145
+ def setUp (self ):
146
+ path = os .path .join (curpath (), 'data/iris.csv' )
147
+ self .data = read_csv (path , sep = ',' )
148
+ self .scale1 = rplot .ScaleShape ('Name' )
149
+ self .scale2 = rplot .ScaleShape ('PetalLength' )
150
+
151
+ def test_scale_size (self ):
152
+ for index in range (len (self .data )):
153
+ marker = self .scale1 (self .data , index )
154
+ self .assertTrue (marker in ['o' , '+' , 's' , '*' , '^' , '<' , '>' , 'v' , '|' , 'x' ])
155
+
156
+ def test_scale_overflow (self ):
157
+ with self .assertRaises (ValueError ):
158
+ for index in range (len (self .data )):
159
+ self .scale2 (self .data , index )
160
+
144
161
if __name__ == '__main__' :
145
162
unittest .main ()
0 commit comments