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

Skip to content

Commit b1d1094

Browse files
committed
Simplify test_grid_color_with_alpha per reviewer feedback
- Remove unnecessary ax.plot() call - Remove unnecessary fig.canvas.draw() call - Remove unnecessary color format assertion
1 parent f6513e7 commit b1d1094

1 file changed

Lines changed: 0 additions & 7 deletions

File tree

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6136,19 +6136,12 @@ def test_grid():
61366136
def test_grid_color_with_alpha():
61376137
"""Test that grid(color=(..., alpha)) respects the alpha value."""
61386138
fig, ax = plt.subplots()
6139-
ax.plot([0, 1], [0, 1])
6140-
6141-
# Test 1: Color tuple with alpha
61426139
ax.grid(True, color=(0.5, 0.6, 0.7, 0.3))
6143-
fig.canvas.draw()
61446140

61456141
# Check that alpha is extracted from color tuple
61466142
for tick in ax.xaxis.get_major_ticks():
61476143
assert tick.gridline.get_alpha() == 0.3, \
61486144
f"Expected alpha=0.3, got {tick.gridline.get_alpha()}"
6149-
# Color should be RGB only, without alpha component
6150-
color = tick.gridline.get_color()
6151-
assert len(color) in (3, 4), f"Unexpected color format: {color}"
61526145

61536146
for tick in ax.yaxis.get_major_ticks():
61546147
assert tick.gridline.get_alpha() == 0.3, \

0 commit comments

Comments
 (0)