Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit5ef00b1

Browse files
committed
Add expected failures for tree-construction tests.
1 parent95b673f commit5ef00b1

File tree

4 files changed

+138
-8
lines changed

4 files changed

+138
-8
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
#data
2+
<html><ruby>a<rtc>b<rt>c<rb>d</ruby></html>
3+
4+
#data
5+
<html><ruby>a<rb>b<rt></ruby></html>
6+
7+
#data
8+
<!DOCTYPE html><body><svg attributename='' attributetype='' basefrequency='' baseprofile='' calcmode='' clippathunits='' contentscripttype='' contentstyletype='' diffuseconstant='' edgemode='' externalresourcesrequired='' filterres='' filterunits='' glyphref='' gradienttransform='' gradientunits='' kernelmatrix='' kernelunitlength='' keypoints='' keysplines='' keytimes='' lengthadjust='' limitingconeangle='' markerheight='' markerunits='' markerwidth='' maskcontentunits='' maskunits='' numoctaves='' pathlength='' patterncontentunits='' patterntransform='' patternunits='' pointsatx='' pointsaty='' pointsatz='' preservealpha='' preserveaspectratio='' primitiveunits='' refx='' refy='' repeatcount='' repeatdur='' requiredextensions='' requiredfeatures='' specularconstant='' specularexponent='' spreadmethod='' startoffset='' stddeviation='' stitchtiles='' surfacescale='' systemlanguage='' tablevalues='' targetx='' targety='' textlength='' viewbox='' viewtarget='' xchannelselector='' ychannelselector='' zoomandpan=''></svg>
9+
10+
#data
11+
<html><ruby>a<rt>b<rb></ruby></html>
12+
13+
#data
14+
<html><ruby>a<rt>b<rtc></ruby></html>
15+
16+
#data
17+
<html><ruby><rtc><ruby>a<rb>b<rt></ruby></ruby></html>
18+
19+
#data
20+
<!DOCTYPE html><body><command>A
21+
22+
#data
23+
<html><ruby>a<rb>b<rp></ruby></html>
24+
25+
#data
26+
<!DOCTYPE html><body><svg attributeName='' attributeType='' baseFrequency='' baseProfile='' calcMode='' clipPathUnits='' contentScriptType='' contentStyleType='' diffuseConstant='' edgeMode='' externalResourcesRequired='' filterRes='' filterUnits='' glyphRef='' gradientTransform='' gradientUnits='' kernelMatrix='' kernelUnitLength='' keyPoints='' keySplines='' keyTimes='' lengthAdjust='' limitingConeAngle='' markerHeight='' markerUnits='' markerWidth='' maskContentUnits='' maskUnits='' numOctaves='' pathLength='' patternContentUnits='' patternTransform='' patternUnits='' pointsAtX='' pointsAtY='' pointsAtZ='' preserveAlpha='' preserveAspectRatio='' primitiveUnits='' refX='' refY='' repeatCount='' repeatDur='' requiredExtensions='' requiredFeatures='' specularConstant='' specularExponent='' spreadMethod='' startOffset='' stdDeviation='' stitchTiles='' surfaceScale='' systemLanguage='' tableValues='' targetX='' targetY='' textLength='' viewBox='' viewTarget='' xChannelSelector='' yChannelSelector='' zoomAndPan=''></svg>
27+
28+
#data
29+
<html><ruby>a<rtc>b<rtc></ruby></html>
30+
31+
#data
32+
<!DOCTYPE html><frameset> te st
33+
34+
#data
35+
<html><ruby>a<rp>b<rtc></ruby></html>
36+
37+
#data
38+
<!DOCTYPE html><frameset></frameset> te st
39+
40+
#data
41+
<html><ruby>a<rb>b<rb></ruby></html>
42+
43+
#data
44+
<html><ruby>a<rtc>b<rp></ruby></html>
45+
46+
#data
47+
<!DOCTYPE html><body><menuitem>A
48+
49+
#data
50+
<!DOCTYPE html><BODY><SVG ATTRIBUTENAME='' ATTRIBUTETYPE='' BASEFREQUENCY='' BASEPROFILE='' CALCMODE='' CLIPPATHUNITS='' CONTENTSCRIPTTYPE='' CONTENTSTYLETYPE='' DIFFUSECONSTANT='' EDGEMODE='' EXTERNALRESOURCESREQUIRED='' FILTERRES='' FILTERUNITS='' GLYPHREF='' GRADIENTTRANSFORM='' GRADIENTUNITS='' KERNELMATRIX='' KERNELUNITLENGTH='' KEYPOINTS='' KEYSPLINES='' KEYTIMES='' LENGTHADJUST='' LIMITINGCONEANGLE='' MARKERHEIGHT='' MARKERUNITS='' MARKERWIDTH='' MASKCONTENTUNITS='' MASKUNITS='' NUMOCTAVES='' PATHLENGTH='' PATTERNCONTENTUNITS='' PATTERNTRANSFORM='' PATTERNUNITS='' POINTSATX='' POINTSATY='' POINTSATZ='' PRESERVEALPHA='' PRESERVEASPECTRATIO='' PRIMITIVEUNITS='' REFX='' REFY='' REPEATCOUNT='' REPEATDUR='' REQUIREDEXTENSIONS='' REQUIREDFEATURES='' SPECULARCONSTANT='' SPECULAREXPONENT='' SPREADMETHOD='' STARTOFFSET='' STDDEVIATION='' STITCHTILES='' SURFACESCALE='' SYSTEMLANGUAGE='' TABLEVALUES='' TARGETX='' TARGETY='' TEXTLENGTH='' VIEWBOX='' VIEWTARGET='' XCHANNELSELECTOR='' YCHANNELSELECTOR='' ZOOMANDPAN=''></SVG>
51+
52+
#data
53+
<html><ruby>a<rp>b<rb></ruby></html>
54+
55+
#data
56+
<html><ruby>a<rb>b<rtc></ruby></html>
57+
58+
#data
59+
<html><ruby>a<rtc>b<rb></ruby></html>

‎html5lib/tests/support.py‎

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -175,3 +175,15 @@ def processingInstruction(self, target, data):
175175

176176
defskippedEntity(self,name):
177177
self.visited.append(('skippedEntity',name))
178+
179+
180+
defxfail(test):
181+
"""Expected fail decorator function"""
182+
deft(*args,**kwargs):
183+
try:
184+
test(*args)
185+
except:
186+
return
187+
else:
188+
assertFalse,"UNEXPECTED PASS"
189+
returnt

‎html5lib/tests/test_parser.py‎

Lines changed: 36 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010

1111
from .supportimportget_data_files
1212
from .supportimportTestData,convert,convertExpected,treeTypes
13+
from .supportimportxfail
1314
fromhtml5libimporthtml5parser,constants
1415

1516
# Run the parse error checks
@@ -26,7 +27,11 @@ def convertTreeDump(data):
2627

2728

2829
defrunParserTest(innerHTML,input,expected,errors,treeClass,
29-
namespaceHTMLElements):
30+
namespaceHTMLElements,scriptingDisabled):
31+
ifscriptingDisabled:
32+
# We don't support the scripting disabled case!
33+
return
34+
3035
withwarnings.catch_warnings(record=True)ascaughtWarnings:
3136
warnings.simplefilter("always")
3237
p=html5parser.HTMLParser(tree=treeClass,
@@ -71,10 +76,24 @@ def runParserTest(innerHTML, input, expected, errors, treeClass,
7176
assertlen(p.errors)==len(errors),errorMsg2
7277

7378

79+
@xfail
80+
defxfailRunParserTest(*args,**kwargs):
81+
returnrunParserTest(*args,**kwargs)
82+
83+
7484
deftest_parser():
85+
# Testin'
7586
sys.stderr.write('Testing tree builders '+" ".join(list(treeTypes.keys()))+"\n")
76-
files=get_data_files('tree-construction')
7787

88+
# Get xfails
89+
filename=os.path.join(os.path.split(__file__)[0],
90+
"expected-failures",
91+
"tree-construction.dat")
92+
xfails=TestData(filename,"data")
93+
xfails=frozenset([x["data"]forxinxfails])
94+
95+
# Get the tests
96+
files=get_data_files('tree-construction')
7897
forfilenameinfiles:
7998
testName=os.path.basename(filename).replace(".dat","")
8099
iftestNamein ("template",):
@@ -84,13 +103,25 @@ def test_parser():
84103

85104
forindex,testinenumerate(tests):
86105
input,errors,innerHTML,expected= [test[key]forkeyin
87-
('data','errors',
106+
('data',
107+
'errors',
88108
'document-fragment',
89109
'document')]
110+
90111
iferrors:
91112
errors=errors.split("\n")
92113

114+
assertnot ("script-off"intestand"script-on"intest), \
115+
("The following test has scripting enabled"+
116+
"and disabled all at once: %s in %s"% (input,filename))
117+
118+
scriptingDisabled="script-off"intest
119+
93120
fortreeName,treeClsintreeTypes.items():
94121
fornamespaceHTMLElementsin (True,False):
95-
yield (runParserTest,innerHTML,input,expected,errors,treeCls,
96-
namespaceHTMLElements)
122+
ifinputinxfails:
123+
testFunc=xfailRunParserTest
124+
else:
125+
testFunc=runParserTest
126+
yield (testFunc,innerHTML,input,expected,errors,treeCls,
127+
namespaceHTMLElements,scriptingDisabled)

‎html5lib/tests/test_treewalkers.py‎

Lines changed: 31 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
exceptAttributeError:
1212
unittest.TestCase.assertEqual=unittest.TestCase.assertEquals
1313

14-
from .supportimportget_data_files,TestData,convertExpected
14+
from .supportimportget_data_files,TestData,convertExpected,xfail
1515

1616
fromhtml5libimporthtml5parser,treewalkers,treebuilders,constants
1717

@@ -250,7 +250,11 @@ def test_all_tokens(self):
250250
self.assertEqual(expectedToken,outputToken)
251251

252252

253-
defrunTreewalkerTest(innerHTML,input,expected,errors,treeClass):
253+
defrunTreewalkerTest(innerHTML,input,expected,errors,treeClass,scriptingDisabled):
254+
ifscriptingDisabled:
255+
# We don't support the scripting disabled case!
256+
return
257+
254258
warnings.resetwarnings()
255259
warnings.simplefilter("error")
256260
try:
@@ -281,9 +285,22 @@ def runTreewalkerTest(innerHTML, input, expected, errors, treeClass):
281285
pass# Amnesty for those that confess...
282286

283287

288+
@xfail
289+
defxfailRunTreewalkerTest(*args,**kwargs):
290+
returnrunTreewalkerTest(*args,**kwargs)
291+
292+
284293
deftest_treewalker():
285294
sys.stdout.write('Testing tree walkers '+" ".join(list(treeTypes.keys()))+"\n")
286295

296+
# Get xfails
297+
filename=os.path.join(os.path.split(__file__)[0],
298+
"expected-failures",
299+
"tree-construction.dat")
300+
xfails=TestData(filename,"data")
301+
xfails=frozenset([x["data"]forxinxfails])
302+
303+
# Get the tests
287304
fortreeName,treeClsintreeTypes.items():
288305
files=get_data_files('tree-construction')
289306
forfilenameinfiles:
@@ -299,7 +316,18 @@ def test_treewalker():
299316
"document-fragment",
300317
"document")]
301318
errors=errors.split("\n")
302-
yieldrunTreewalkerTest,innerHTML,input,expected,errors,treeCls
319+
320+
assertnot ("script-off"intestand"script-on"intest), \
321+
("The following test has scripting enabled"+
322+
"and disabled all at once: %s in %s"% (input,filename))
323+
324+
scriptingDisabled="script-off"intest
325+
326+
ifinputinxfails:
327+
testFunc=xfailRunTreewalkerTest
328+
else:
329+
testFunc=runTreewalkerTest
330+
yieldtestFunc,innerHTML,input,expected,errors,treeCls,scriptingDisabled
303331

304332

305333
defset_attribute_on_first_child(docfrag,name,value,treeName):

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp