| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -27,7 +27,7 @@ def convertTreeDump(data): | |||
| 27 | 27 | ||
| 28 | 28 | def runParserTest(innerHTML, input, expected, errors, treeClass, | |
| 29 | 29 | namespaceHTMLElements): | |
| 30 | - with warnings.catch_warnings(record=True) as w: | ||
| 30 | + with warnings.catch_warnings(record=True) as caughtWarnings: | ||
| 31 | 31 | warnings.simplefilter("always") | |
| 32 | 32 | p = html5parser.HTMLParser(tree=treeClass, | |
| 33 | 33 | namespaceHTMLElements=namespaceHTMLElements) | |
@@ -42,9 +42,10 @@ def runParserTest(innerHTML, input, expected, errors, treeClass, | |||
| 42 | 42 | "\nTraceback:", traceback.format_exc()]) | |
| 43 | 43 | assert False, errorMsg | |
| 44 | 44 | ||
| 45 | - otherW = [x for x in w if not issubclass(x.category, constants.DataLossWarning)] | ||
| 46 | - assert len(otherW) == 0, [(x.category, x.message) for x in otherW] | ||
| 47 | - if len(w): | ||
| 45 | + otherWarnings = [x for x in caughtWarnings | ||
| 46 | + if not issubclass(x.category, constants.DataLossWarning)] | ||
| 47 | + assert len(otherWarnings) == 0, [(x.category, x.message) for x in otherWarnings] | ||
| 48 | + if len(caughtWarnings): | ||
| 48 | 49 | return | |
| 49 | 50 | ||
| 50 | 51 | output = convertTreeDump(p.tree.testSerializer(document)) | |
| Back | FazBrowse Home | New Git URL |
0 commit comments