Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 52ab00d

Browse files
committed
put imports at top of tests and added 's at the start of each exp_trisurf_plot color in 'data'
1 parent ccc6eb3 commit 52ab00d

File tree

2 files changed

+10
-13
lines changed

2 files changed

+10
-13
lines changed

plotly/colors.py

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"""
2020
from __future__ import absolute_import
2121
from plotly import exceptions
22+
from numbers import Number
2223

2324
DEFAULT_PLOTLY_COLORS = ['rgb(31, 119, 180)', 'rgb(255, 127, 14)',
2425
'rgb(44, 160, 44)', 'rgb(214, 39, 40)',
@@ -157,7 +158,6 @@ def color_parser(colors, function):
157158
- rgb string, hex string or tuple
158159
159160
"""
160-
from numbers import Number
161161
if isinstance(colors, str):
162162
return function(colors)
163163

@@ -178,7 +178,6 @@ def validate_colors(colors):
178178
"""
179179
Validates color(s) and returns an error for invalid colors
180180
"""
181-
from numbers import Number
182181
colors_list = []
183182

184183
if isinstance(colors, str):
@@ -199,8 +198,7 @@ def validate_colors(colors):
199198
colors_list = list(colors)
200199

201200
if isinstance(colors, dict):
202-
for color in colors.values():
203-
colors_list.append(color)
201+
colors_list.extend(colors.values())
204202

205203
elif isinstance(colors, list):
206204
colors_list = colors
@@ -242,7 +240,6 @@ def convert_colors_to_same_type(colors, colortype='rgb'):
242240
Plotly Scale name then the cooresponding colorscale will be outputted and
243241
colortype will not be applicable
244242
"""
245-
from numbers import Number
246243
colors_list = []
247244

248245
if isinstance(colors, str):

plotly/tests/test_optional/test_figure_factory.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -843,14 +843,14 @@ def test_trisurf_all_args(self):
843843

844844
exp_trisurf_plot = {
845845
'data': [{'facecolor': np.array(
846-
['rgb(145.0, 96.0, 143.0)',
847-
'rgb(29.0, 190.0, 201.0)',
848-
'rgb(145.0, 96.0, 143.0)',
849-
'rgb(31.0, 119.0, 180.0)',
850-
'rgb(145.0, 96.0, 143.0)',
851-
'rgb(31.0, 119.0, 180.0)',
852-
'rgb(145.0, 96.0, 143.0)',
853-
'rgb(29.0, 190.0, 201.0)'],
846+
[b'rgb(145.0, 96.0, 143.0)',
847+
b'rgb(29.0, 190.0, 201.0)',
848+
b'rgb(145.0, 96.0, 143.0)',
849+
b'rgb(31.0, 119.0, 180.0)',
850+
b'rgb(145.0, 96.0, 143.0)',
851+
b'rgb(31.0, 119.0, 180.0)',
852+
b'rgb(145.0, 96.0, 143.0)',
853+
b'rgb(29.0, 190.0, 201.0)'],
854854
dtype='|S23'
855855
),
856856
'i': np.array([3, 1, 1, 5, 7, 3, 5, 7], dtype='int32'),

0 commit comments

Comments
 (0)