diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2018-08-11 06:05:04 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 06:05:04 (GMT) |
commit | 84a13fbda0d79789e3c9efcc9f64752261ce1e8d (patch) | |
tree | 5cc443f7bbfde403e0f7a731b5fda5fb4f54676a /Lib/test/test_pulldom.py | |
parent | 423d05f6f59b24c91b9ef6b2e4ac130316764382 (diff) | |
download | cpython-84a13fbda0d79789e3c9efcc9f64752261ce1e8d.zip cpython-84a13fbda0d79789e3c9efcc9f64752261ce1e8d.tar.gz cpython-84a13fbda0d79789e3c9efcc9f64752261ce1e8d.tar.bz2 |
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.
Diffstat (limited to 'Lib/test/test_pulldom.py')
-rw-r--r-- | Lib/test/test_pulldom.py | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_pulldom.py b/Lib/test/test_pulldom.py index 3d89e3a..f454098 100644 --- a/Lib/test/test_pulldom.py +++ b/Lib/test/test_pulldom.py @@ -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.""" |