Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 49fc336

Browse filesBrowse files
committed
updated the tests to account for rounding floats in rgb to nearest int
1 parent 2299a26 commit 49fc336
Copy full SHA for 49fc336

File tree

4 files changed

+85
-70
lines changed
Filter options

4 files changed

+85
-70
lines changed

‎plotly/tests/test_core/test_tools/test_figure_factory.py

Copy file name to clipboardExpand all lines: plotly/tests/test_core/test_tools/test_figure_factory.py
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,7 +1402,7 @@ def test_2D_density_all_args(self):
14021402
point_size=3, height=800, width=800)
14031403

14041404
exp_2D_density_chart = {
1405-
'data': [{'marker': {'color': 'rgb(0, 0, 127)',
1405+
'data': [{'marker': {'color': 'rgb(0, 0, 128)',
14061406
'opacity': 0.4,
14071407
'size': 3},
14081408
'mode': 'markers',
@@ -1414,7 +1414,7 @@ def test_2D_density_all_args(self):
14141414
[0.25, 'rgb(213, 96, 115)'],
14151415
[0.5, 'rgb(236, 158, 105)'],
14161416
[0.75, 'rgb(255, 255, 51)'],
1417-
[1.0, 'rgb(249, 249, 249)']],
1417+
[1.0, 'rgb(250, 250, 250)']],
14181418
'name': 'density',
14191419
'ncontours': 20,
14201420
'reversescale': True,

‎plotly/tests/test_optional/temp-plot.html

Copy file name to clipboardExpand all lines: plotly/tests/test_optional/temp-plot.html
+55-40Lines changed: 55 additions & 40 deletions
Large diffs are not rendered by default.

‎plotly/tests/test_optional/test_figure_factory.py

Copy file name to clipboardExpand all lines: plotly/tests/test_optional/test_figure_factory.py
+25-25Lines changed: 25 additions & 25 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(144.0, 94.5, 132.0)',
847-
'rgb(23.0, 190.0, 207.0)',
848-
'rgb(144.0, 94.5, 132.0)',
849-
'rgb(31.0, 119.0, 180.0)',
850-
'rgb(144.0, 94.5, 132.0)',
851-
'rgb(31.0, 119.0, 180.0)',
852-
'rgb(144.0, 94.5, 132.0)',
853-
'rgb(23.0, 190.0, 207.0)']
846+
['rgb(144, 95, 132)',
847+
'rgb(23, 190, 207)',
848+
'rgb(144, 95, 132)',
849+
'rgb(31, 119, 180)',
850+
'rgb(144, 95, 132)',
851+
'rgb(31, 119, 180)',
852+
'rgb(144, 95, 132)',
853+
'rgb(23, 190, 207)']
854854
),
855855
'i': np.array([3, 1, 1, 5, 7, 3, 5, 7]),
856856
'j': np.array([1, 3, 5, 1, 3, 7, 7, 5]),
@@ -884,16 +884,16 @@ def test_trisurf_all_args(self):
884884
-0.0, 0.0, 0.0, None, -0.0, 0.0, -1.0,
885885
-0.0, None, 0.0, 0.0, 0.0, 0.0, None,
886886
0.0, 0.0, 1.0, 0.0, None])},
887-
{'colorscale': [[0.0, 'rgb(31.0, 119.0, 180.0)'],
888-
[0.1111111111111111, 'rgb(255.0, 127.0, 14.0)'],
889-
[0.2222222222222222, 'rgb(44.0, 160.0, 44.0)'],
890-
[0.3333333333333333, 'rgb(214.0, 39.0, 40.0)'],
891-
[0.4444444444444444, 'rgb(148.0, 103.0, 189.0)'],
892-
[0.5555555555555556, 'rgb(140.0, 86.0, 75.0)'],
893-
[0.6666666666666666, 'rgb(227.0, 119.0, 194.0)'],
894-
[0.7777777777777778, 'rgb(127.0, 127.0, 127.0)'],
895-
[0.8888888888888888, 'rgb(188.0, 189.0, 34.0)'],
896-
[1.0, 'rgb(23.0, 190.0, 207.0)']],
887+
{'colorscale': [[0.0, 'rgb(31, 119, 180)'],
888+
[0.1111111111111111, 'rgb(255, 127, 14)'],
889+
[0.2222222222222222, 'rgb(44, 160, 44)'],
890+
[0.3333333333333333, 'rgb(214, 39, 40)'],
891+
[0.4444444444444444, 'rgb(148, 103, 189)'],
892+
[0.5555555555555556, 'rgb(140, 86, 75)'],
893+
[0.6666666666666666, 'rgb(227, 119, 194)'],
894+
[0.7777777777777778, 'rgb(127, 127, 127)'],
895+
[0.8888888888888888, 'rgb(188, 189, 34)'],
896+
[1.0, 'rgb(23, 190, 207)']],
897897
'intensity': [0, 1],
898898
'showscale': True,
899899
'type': 'mesh3d',
@@ -1261,13 +1261,13 @@ def test_scatter_plot_matrix_kwargs(self):
12611261
)
12621262

12631263
exp_scatter_plot_matrix = {
1264-
'data': [{'marker': {'color': 'rgb(128.0, 0.0, 38.0)'},
1264+
'data': [{'marker': {'color': 'rgb(128, 0, 38)'},
12651265
'showlegend': False,
12661266
'type': 'histogram',
12671267
'x': [2, -15, -2, 0],
12681268
'xaxis': 'x1',
12691269
'yaxis': 'y1'},
1270-
{'marker': {'color': 'rgb(255.0, 255.0, 204.0)'},
1270+
{'marker': {'color': 'rgb(255, 255, 204)'},
12711271
'showlegend': False,
12721272
'type': 'histogram',
12731273
'x': [6, 5],
@@ -1324,7 +1324,7 @@ def test_df_dataframe_all_args(self):
13241324
'shapes': [{'opacity': 1,
13251325
'y1': 0.2,
13261326
'xref': 'x',
1327-
'fillcolor': 'rgb(31.0, 119.0, 180.0)',
1327+
'fillcolor': 'rgb(31, 119, 180)',
13281328
'yref': 'y',
13291329
'y0': -0.2,
13301330
'x0': '2009-01-01',
@@ -1334,7 +1334,7 @@ def test_df_dataframe_all_args(self):
13341334
{'opacity': 1,
13351335
'y1': 1.2,
13361336
'xref': 'x',
1337-
'fillcolor': 'rgb(255.0, 127.0, 14.0)',
1337+
'fillcolor': 'rgb(255, 127, 14)',
13381338
'yref': 'y',
13391339
'y0': 0.8,
13401340
'x0': '2009-03-05',
@@ -1543,7 +1543,7 @@ def test_violin_fig(self):
15431543

15441544
exp_violin = {
15451545
'data': [{'fill': 'tonextx',
1546-
'fillcolor': 'rgb(31.0, 119.0, 180.0)',
1546+
'fillcolor': 'rgb(31, 119, 180)',
15471547
'hoverinfo': 'text',
15481548
'line': {'color': 'rgb(0, 0, 0)',
15491549
'shape': 'spline',
@@ -1721,7 +1721,7 @@ def test_violin_fig(self):
17211721
1.96969697, 1.97979798, 1.98989899,
17221722
2.])},
17231723
{'fill': 'tonextx',
1724-
'fillcolor': 'rgb(31.0, 119.0, 180.0)',
1724+
'fillcolor': 'rgb(31, 119, 180)',
17251725
'hoverinfo': 'text',
17261726
'line': {'color': 'rgb(0, 0, 0)',
17271727
'shape': 'spline',
@@ -1921,7 +1921,7 @@ def test_violin_fig(self):
19211921
'x': [0],
19221922
'y': [1.5]},
19231923
{'hoverinfo': 'y',
1924-
'marker': {'color': 'rgb(31.0, 119.0, 180.0)',
1924+
'marker': {'color': 'rgb(31, 119, 180)',
19251925
'symbol': 'line-ew-open'},
19261926
'mode': 'markers',
19271927
'name': '',

‎plotly/tools.py

Copy file name to clipboardExpand all lines: plotly/tools.py
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4566,9 +4566,9 @@ def _convert_to_RGB_255(colors):
45664566
then is turned into an integer
45674567
"""
45684568

4569-
return (round(int(colors[0]*255.0)),
4570-
round(int(colors[1]*255.0)),
4571-
round(int(colors[2]*255.0)))
4569+
return (int(round(colors[0]*255.0)),
4570+
int(round(colors[1]*255.0)),
4571+
int(round(colors[2]*255.0)))
45724572

45734573
@staticmethod
45744574
def _n_colors(lowcolor, highcolor, n_colors):

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.