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

Skip to content

Commit 1227893

Browse files
committed
testing: add test for SF#2856495
svn path=/trunk/matplotlib/; revision=7733
1 parent 4372fe3 commit 1227893

2 files changed

Lines changed: 31 additions & 0 deletions

File tree

lib/matplotlib/__init__.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -878,6 +878,7 @@ def tk_window_focus():
878878

879879
default_test_modules = [
880880
'matplotlib.tests.test_agg',
881+
'matplotlib.tests.test_backend_svg',
881882
'matplotlib.tests.test_basic',
882883
'matplotlib.tests.test_cbook',
883884
'matplotlib.tests.test_transforms',
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
import matplotlib.pyplot as plt
2+
import numpy as np
3+
import cStringIO as StringIO
4+
import xml.parsers.expat
5+
from matplotlib.testing.decorators import knownfailureif
6+
7+
@knownfailureif(True)
8+
def test_visibility():
9+
# This is SF 2856495. See
10+
# https://sourceforge.net/tracker/?func=detail&aid=2856495&group_id=80706&atid=560720
11+
fig=plt.figure()
12+
ax=fig.add_subplot(1,1,1)
13+
14+
x = np.linspace(0,4*np.pi,50)
15+
y = np.sin(x)
16+
yerr = np.ones_like(y)
17+
18+
a,b,c=ax.errorbar(x,y,yerr=yerr,fmt='ko')
19+
for artist in b:
20+
artist.set_visible(False)
21+
22+
fd = StringIO.StringIO()
23+
fig.savefig(fd,format='svg')
24+
25+
fd.seek(0)
26+
buf = fd.read()
27+
fd.close()
28+
29+
parser = xml.parsers.expat.ParserCreate()
30+
parser.Parse(buf) # this will raise ExpatError if the svg is invalid

0 commit comments

Comments
 (0)