fix test failure for fromxml() without lxml
@@ -284,9 +284,13 @@ def test_fromxml_entity():
_EXPECT_NO = ((None, None),)
+ try:
from lxml import etree
parser_off = etree.XMLParser(resolve_entities=False)
parser_onn = etree.XMLParser(resolve_entities=True)
+ found_lxml = True
+ except:
+ found_lxml = False
data_file_tmp = _write_temp_file(_DATA2)
doc_type_temp = _DOCTYPE % data_file_tmp
@@ -299,12 +303,14 @@ def test_fromxml_entity():
actual11 = fromxml(temp_file1, 'tr', 'td')
_compare(_TABLE1, actual11)
+ if found_lxml:
actual12 = fromxml(temp_file1, 'tr', 'td', parser=parser_off)
_compare(_TABLE1, actual12)
actual21 = fromxml(temp_file2, 'tr', 'td')
_compare(_TABLE1 + _EXPECT_NO, actual21)
+ if found_lxml:
actual22 = fromxml(temp_file2, 'tr', 'td', parser=parser_off)
_compare(_TABLE1 + _EXPECT_NO, actual22)
@@ -314,9 +320,9 @@ def test_fromxml_entity():
actual31 = fromxml(temp_file3, 'tr', 'td')
_compare(_TABLE1 + _EXPECT_NO, actual31)
+ if found_lxml:
actual32 = fromxml(temp_file3, 'tr', 'td', parser=parser_off)
_compare(_TABLE1 + _EXPECT_NO, actual32)
-
try:
actual33 = fromxml(temp_file3, 'tr', 'td', parser=parser_onn)
for _ in actual33:
