8000 fixup! fix a unicode_literals regression in ihatexml.py · ambv/html5lib-python@add2c55 · GitHub
[go: up one dir, main page]

Skip to content

Commit add2c55

Browse files
committed
fixup! fix a unicode_literals regression in ihatexml.py
1 parent 9cc84af commit add2c55

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

html5lib/tests/test_parser2.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,11 @@
11
from __future__ import absolute_import, division, unicode_literals
22

33
import io
4+
import warnings
45

56
from . import support # flake8: noqa
67
from html5lib import html5parser
7-
from html5lib.constants import namespaces
8+
from html5lib.constants import namespaces, DataLossWarning
89
from html5lib import treebuilders
910

1011
import unittest
@@ -35,7 +36,13 @@ def test_ihatexml(self):
3536
if not self.lxml_tree:
3637
return
3738
parser = html5parser.HTMLParser(tree=self.lxml_tree)
38-
parser.parse(b'<p xml:lang="pl">Witam wszystkich')
39+
with warnings.catch_warnings(record=True) as w:
40+
warnings.simplefilter("always")
41+
42+
parser.parse(b'<p xml:lang="pl">Witam wszystkich')
43+
44+
self.assertEqual(len(w), 1)
45+
self.assertTrue(issubclass(w[-1].category, DataLossWarning))
3946

4047
def test_namespace_html_elements_0_dom(self):
4148
parser = html5parser.HTMLParser(tree=self.dom_tree, namespaceHTMLElements=True)

0 commit comments

Comments
 (0)
0