Skip to content

Commit

Permalink
etree: Make test_flush_reparse_deferral_disabled less exclusive
Browse files Browse the repository at this point in the history
The test only needs to exclude Expat >=2.6.0 with etree C version;
all else is possible, was overly exclusive by mistake.
  • Loading branch information
hartwork committed Feb 24, 2024
1 parent 3c960a6 commit 4855bb9
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions Lib/test/test_xml_etree.py
Original file line number Diff line number Diff line change
Expand Up @@ -1737,22 +1737,24 @@ def test_flush_reparse_deferral_disabled(self):
parser = ET.XMLPullParser(events=('start', 'end'))
is_python = hasattr(parser._parser, '_parser') # rather than C

if not is_python:
self.skipTest(f'XMLParser.(Get|Set)ReparseDeferralEnabled methods not available in C')

for chunk in ("<doc", ">"):
parser.feed(chunk)

if pyexpat.version_info >= (2, 6, 0):
if not is_python:
self.skipTest(f'XMLParser.(Get|Set)ReparseDeferralEnabled '
'methods not available in C')
parser._parser._parser.SetReparseDeferralEnabled(False)

self.assert_event_tags(parser, []) # i.e. no elements started
self.assertFalse(parser._parser._parser.GetReparseDeferralEnabled())
if is_python:
self.assertFalse(parser._parser._parser.GetReparseDeferralEnabled())

parser.flush()

self.assert_event_tags(parser, [('start', 'doc')])
self.assertFalse(parser._parser._parser.GetReparseDeferralEnabled())
if is_python:
self.assertFalse(parser._parser._parser.GetReparseDeferralEnabled())

parser.feed("</doc>")
parser.close()
Expand Down

0 comments on commit 4855bb9

Please sign in to comment.