File tree Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Expand file tree Collapse file tree 1 file changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -116,5 +116,23 @@ def test_gradient2(self):
116
116
self .assertTrue (between (g2 , g3 , g ))
117
117
self .assertTrue (between (b2 , b3 , b ))
118
118
119
+ class TestScaleRandomColour (unittest .TestCase ):
120
+ def setUp (self ):
121
+ path = os .path .join (curpath (), 'data/iris.csv' )
122
+ self .data = read_csv (path , sep = ',' )
123
+ self .colour = rplot .ScaleRandomColour ('SepalLength' )
124
+
125
+ def test_random_colour (self ):
126
+ for index in range (len (self .data )):
127
+ colour = self .colour (self .data , index )
128
+ self .assertEqual (len (colour ), 3 )
129
+ r , g , b = colour
130
+ self .assertGreaterEqual (r , 0.0 )
131
+ self .assertGreaterEqual (g , 0.0 )
132
+ self .assertGreaterEqual (b , 0.0 )
133
+ self .assertLessEqual (r , 1.0 )
134
+ self .assertLessEqual (g , 1.0 )
135
+ self .assertLessEqual (b , 1.0 )
136
+
119
137
if __name__ == '__main__' :
120
138
unittest .main ()
You can’t perform that action at this time.
0 commit comments