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

Skip to content

Commit fb2c139

Browse files
committed
Code formatting
Had some issues with running black locally due to version problems. Now resolved and formatted the test code accordingly :)
1 parent 282ed0d commit fb2c139

File tree

1 file changed

+19
-7
lines changed
  • packages/python/plotly/plotly/tests/test_core/test_colors

1 file changed

+19
-7
lines changed

packages/python/plotly/plotly/tests/test_core/test_colors/test_colors.py

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -142,17 +142,29 @@ def test_sample_colorscale(self):
142142

143143
# test that sampling a colorscale at the defined points returns the same
144144
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]
147151
self.assertEqual(sampled_colors, defined_colors_rgb)
148152

149153
# 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)"]
151155
samplepoints = [0.0, 0.125, 0.25, 0.375, 0.5, 0.625, 0.75, 0.875, 1.0]
152156
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),
156166
]
157-
output = colors.sample_colorscale(defined_colors, samplepoints, colortype="tuple")
167+
output = colors.sample_colorscale(
168+
defined_colors, samplepoints, colortype="tuple"
169+
)
158170
self.assertEqual(expected_output, output)

0 commit comments

Comments
 (0)