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

Commit68d6f34

Browse files
committed
Remove last remanent of unittest from test_treewalkers.py
1 parenta75b120 commit68d6f34

File tree

1 file changed

+23
-31
lines changed

1 file changed

+23
-31
lines changed

‎html5lib/tests/test_treewalkers.py‎

Lines changed: 23 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,5 @@
11
from __future__importabsolute_import,division,unicode_literals
22

3-
importunittest
4-
5-
try:
6-
unittest.TestCase.assertEqual
7-
exceptAttributeError:
8-
unittest.TestCase.assertEqual=unittest.TestCase.assertEquals
9-
103
importpytest
114

125
from .supportimporttreeTypes
@@ -24,30 +17,29 @@ def sortattrs(x):
2417
return"\n".join(lines)
2518

2619

27-
classTokenTestCase(unittest.TestCase):
28-
deftest_all_tokens(self):
29-
expected= [
30-
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'html'},
31-
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'head'},
32-
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'head'},
33-
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'body'},
34-
{'data':'a','type':'Characters'},
35-
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'div'},
36-
{'data':'b','type':'Characters'},
37-
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'div'},
38-
{'data':'c','type':'Characters'},
39-
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'body'},
40-
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'html'}
41-
]
42-
fortreeName,treeClsinsorted(treeTypes.items()):
43-
iftreeClsisNone:
44-
continue
45-
p=html5parser.HTMLParser(tree=treeCls["builder"])
46-
document=p.parse("<html><head></head><body>a<div>b</div>c</body></html>")
47-
document=treeCls.get("adapter",lambdax:x)(document)
48-
output=Lint(treeCls["walker"](document))
49-
forexpectedToken,outputTokeninzip(expected,output):
50-
self.assertEqual(expectedToken,outputToken)
20+
deftest_all_tokens():
21+
expected= [
22+
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'html'},
23+
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'head'},
24+
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'head'},
25+
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'body'},
26+
{'data':'a','type':'Characters'},
27+
{'data': {},'type':'StartTag','namespace':'http://www.w3.org/1999/xhtml','name':'div'},
28+
{'data':'b','type':'Characters'},
29+
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'div'},
30+
{'data':'c','type':'Characters'},
31+
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'body'},
32+
{'type':'EndTag','namespace':'http://www.w3.org/1999/xhtml','name':'html'}
33+
]
34+
fortreeName,treeClsinsorted(treeTypes.items()):
35+
iftreeClsisNone:
36+
continue
37+
p=html5parser.HTMLParser(tree=treeCls["builder"])
38+
document=p.parse("<html><head></head><body>a<div>b</div>c</body></html>")
39+
document=treeCls.get("adapter",lambdax:x)(document)
40+
output=Lint(treeCls["walker"](document))
41+
forexpectedToken,outputTokeninzip(expected,output):
42+
assertexpectedToken==outputToken
5143

5244

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

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp