@@ -142,17 +142,29 @@ def test_sample_colorscale(self):
142
142
143
143
# test that sampling a colorscale at the defined points returns the same
144
144
defined_colors = colors .sequential .Inferno
145
- sampled_colors = colors .sample_colorscale (defined_colors , len (defined_colors ), colortype = "rgb" )
146
- defined_colors_rgb = colors .convert_colors_to_same_type (defined_colors , colortype = 'rgb' )[0 ]
145
+ sampled_colors = colors .sample_colorscale (
146
+ defined_colors , len (defined_colors ), colortype = "rgb"
147
+ )
148
+ defined_colors_rgb = colors .convert_colors_to_same_type (
149
+ defined_colors , colortype = "rgb"
150
+ )[0 ]
147
151
self .assertEqual (sampled_colors , defined_colors_rgb )
148
152
149
153
# test sampling an easy colorscale that goes [red, green, blue]
150
- defined_colors = [' rgb(255,0,0)' , ' rgb(0,255,0)' , ' rgb(0,0,255)' ]
154
+ defined_colors = [" rgb(255,0,0)" , " rgb(0,255,0)" , " rgb(0,0,255)" ]
151
155
samplepoints = [0.0 , 0.125 , 0.25 , 0.375 , 0.5 , 0.625 , 0.75 , 0.875 , 1.0 ]
152
156
expected_output = [
153
- (1.0 , 0.0 , 0.0 ), (0.75 , 0.25 , 0.0 ), (0.5 , 0.5 , 0.0 ),
154
- (0.25 , 0.75 , 0.0 ), (0.0 , 1.0 , 0.0 ), (0.0 , 0.75 , 0.25 ),
155
- (0.0 , 0.5 , 0.5 ), (0.0 , 0.25 , 0.75 ), (0.0 , 0.0 , 1.0 )
157
+ (1.0 , 0.0 , 0.0 ),
158
+ (0.75 , 0.25 , 0.0 ),
159
+ (0.5 , 0.5 , 0.0 ),
160
+ (0.25 , 0.75 , 0.0 ),
161
+ (0.0 , 1.0 , 0.0 ),
162
+ (0.0 , 0.75 , 0.25 ),
163
+ (0.0 , 0.5 , 0.5 ),
164
+ (0.0 , 0.25 , 0.75 ),
165
+ (0.0 , 0.0 , 1.0 ),
156
166
]
157
- output = colors .sample_colorscale (defined_colors , samplepoints , colortype = "tuple" )
167
+ output = colors .sample_colorscale (
168
+ defined_colors , samplepoints , colortype = "tuple"
169
+ )
158
170
self .assertEqual (expected_output , output )
0 commit comments