mirror of
https://github.com/python/cpython.git
synced 2025-10-10 00:43:41 +00:00
bpo-9372: Deprecate several __getitem__ methods (GH-8609)
The __getitem__ methods of DOMEventStream, FileInput, and FileWrapper classes ignore their 'index' parameters and return the next item instead.
This commit is contained in:
parent
423d05f6f5
commit
84a13fbda0
12 changed files with 82 additions and 0 deletions
|
@ -159,6 +159,13 @@ class PullDOMTestCase(unittest.TestCase):
|
|||
self.fail(
|
||||
"Ran out of events, but should have received END_DOCUMENT")
|
||||
|
||||
def test_getitem_deprecation(self):
|
||||
parser = pulldom.parseString(SMALL_SAMPLE)
|
||||
with self.assertWarnsRegex(DeprecationWarning,
|
||||
r'Use iterator protocol instead'):
|
||||
# This should have returned 'END_ELEMENT'.
|
||||
self.assertEqual(parser[-1][0], pulldom.START_DOCUMENT)
|
||||
|
||||
|
||||
class ThoroughTestCase(unittest.TestCase):
|
||||
"""Test the hard-to-reach parts of pulldom."""
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue