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

Skip to content

Commit e3d4e5f

Browse files
Update test_lines.py
Add a test for setting drawstyle after line creation
1 parent e7a2e52 commit e3d4e5f

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

lib/matplotlib/tests/test_lines.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -129,6 +129,18 @@ def test_valid_drawstyles():
129129
with pytest.raises(ValueError):
130130
line.set_drawstyle('foobar')
131131

132+
133+
def test_set_drawstyle():
134+
x = np.linspace(0, 2*np.pi, 10)
135+
y = np.sin(x)
136+
137+
fig, ax = plt.subplots()
138+
line, = ax.plot(x, y)
139+
line.set_drawstyle("steps-pre")
140+
assert len(line.get_path().vertices) == 2*len(x)-1
141+
142+
line.set_drawstyle("default")
143+
assert len(line.get_path().vertices) == len(x)
132144

133145
@image_comparison(baseline_images=['line_collection_dashes'], remove_text=True)
134146
def test_set_line_coll_dash_image():

0 commit comments

Comments
 (0)