Skip to content

Commit 999fd94

Browse files
authored
Avoid skipping code lines depending on random seed (#6256)
Eliminate random decreases of coverage. Make codecov coverage check happy.
1 parent 86f17eb commit 999fd94

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: cirq-core/cirq/vis/heatmap_test.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,8 @@ def test_cell_colors(ax, colormap_name):
105105
col = int(round(np.mean([v[0] for v in vertices])))
106106
value = test_row_col_map[(row, col)]
107107
color_scale = (value - vmin) / (vmax - vmin)
108-
if color_scale < 0.0:
109-
color_scale = 0.0
110-
if color_scale > 1.0:
111-
color_scale = 1.0
108+
color_scale = max(color_scale, 0.0)
109+
color_scale = min(color_scale, 1.0)
112110
expected_color = np.array(colormap(color_scale))
113111
assert np.all(np.isclose(facecolor, expected_color))
114112

0 commit comments

Comments
 (0)