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

Skip to content

Commit ea6ca1a

Browse files
committed
Add a test for Patch accepting 'none' linestyle.
1 parent 2be931b commit ea6ca1a

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

lib/matplotlib/tests/test_patches.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,32 @@ def test_patch_linestyle_accents():
238238
fig.canvas.draw()
239239

240240

241+
@check_figures_equal(extensions=['png'])
242+
def test_patch_linestyle_none(fig_test, fig_ref):
243+
circle = mpath.Path.unit_circle()
244+
245+
ax_test = fig_test.add_subplot()
246+
ax_ref = fig_ref.add_subplot()
247+
for i, ls in enumerate(['none', 'None', ' ', '']):
248+
path = mpath.Path(circle.vertices + i, circle.codes)
249+
patch = mpatches.PathPatch(path,
250+
linewidth=3, linestyle=ls,
251+
facecolor=(1, 0, 0),
252+
edgecolor=(0, 0, 1))
253+
ax_test.add_patch(patch)
254+
255+
patch = mpatches.PathPatch(path,
256+
linewidth=3, linestyle='-',
257+
facecolor=(1, 0, 0),
258+
edgecolor='none')
259+
ax_ref.add_patch(patch)
260+
261+
ax_test.set_xlim([-1, i + 1])
262+
ax_test.set_ylim([-1, i + 1])
263+
ax_ref.set_xlim([-1, i + 1])
264+
ax_ref.set_ylim([-1, i + 1])
265+
266+
241267
def test_wedge_movement():
242268
param_dict = {'center': ((0, 0), (1, 1), 'set_center'),
243269
'r': (5, 8, 'set_radius'),

0 commit comments

Comments
 (0)