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

Skip to content

Commit e7dd0e3

Browse files
committed
Adapt drawstyles test.
Remove duplicated test as well.
1 parent 13b4555 commit e7dd0e3

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

10.7 KB
Loading

lib/matplotlib/tests/test_axes.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4460,12 +4460,6 @@ def test_ls_ds_conflict():
44604460
linestyle='steps-pre:', drawstyle='steps-post')
44614461

44624462

4463-
@cleanup
4464-
def test_ls_ds_conflict():
4465-
assert_raises(ValueError, plt.plot, range(32),
4466-
linestyle='steps-pre:', drawstyle='steps-post')
4467-
4468-
44694463
@image_comparison(baseline_images=['date_timezone_x'], extensions=['png'])
44704464
def test_date_timezone_x():
44714465
# Tests issue 5575

lib/matplotlib/tests/test_lines.py

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -118,16 +118,18 @@ def test_valid_linestyles():
118118
line.set_linestyle('aardvark')
119119

120120

121-
@cleanup
121+
@image_comparison(baseline_images=['drawstyle_variants'], remove_text=True,
122+
extensions=["png"])
122123
def test_drawstyle_variants():
123-
fig = plt.figure()
124-
ax = fig.add_subplot(1, 1, 1)
125-
for ds in ("default", "steps-mid", "steps-pre", "steps-post",
126-
"steps", None):
127-
ax.plot(range(10), drawstyle=ds)
128-
129-
fig.canvas.draw()
130-
assert True
124+
fig, axs = plt.subplots(6)
125+
dss = ["default", "steps-mid", "steps-pre", "steps-post", "steps", None]
126+
# We want to check that drawstyles are properly handled even for very long
127+
# lines (for which the subslice optimization is on); however, we need
128+
# to zoom in so that the difference between the drawstyles is actually
129+
# visible.
130+
for ax, ds in zip(axs.flat, dss):
131+
ax.plot(range(2000), drawstyle=ds)
132+
ax.set(xlim=(0, 2), ylim=(0, 2))
131133

132134

133135
@cleanup

0 commit comments

Comments
 (0)