Skip to content

Commit e4f6fa1

Browse files
committed
Fix tokenizer test harness to not decode tests multiple times.
Given a double escaped test, if it had multiple initial states, the same test object would be decoded multiple times: this led to bogus results on every run except the first.
1 parent a0415f2 commit e4f6fa1

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

html5lib/tests/test_tokenizer.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,6 @@ def decode(inp):
144144
def runTokenizerTest(test):
145145
warnings.resetwarnings()
146146
warnings.simplefilter("error")
147-
#XXX - move this out into the setup function
148-
#concatenate all consecutive character tokens into a single token
149-
if 'doubleEscaped' in test:
150-
test = unescape(test)
151147

152148
expected = concatenateCharacterTokens(test['output'])
153149
if 'lastStartTag' not in test:
@@ -183,10 +179,10 @@ def testTokenizer():
183179
testName = os.path.basename(filename).replace(".test","")
184180
if 'tests' in tests:
185181
for index,test in enumerate(tests['tests']):
186-
#Skip tests with a self closing flag
187-
skip = False
188182
if 'initialStates' not in test:
189183
test["initialStates"] = ["Data state"]
184+
if 'doubleEscaped' in test:
185+
test = unescape(test)
190186
for initialState in test["initialStates"]:
191187
test["initialState"] = capitalize(initialState)
192188
yield runTokenizerTest, test

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy