diff options
author | Berker Peksag <berker.peksag@gmail.com> | 2018-08-11 09:05:04 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-08-11 09:05:04 +0300 |
commit | 84a13fbda0d79789e3c9efcc9f64752261ce1e8d (patch) | |
tree | 5cc443f7bbfde403e0f7a731b5fda5fb4f54676a /Lib/test/test_wsgiref.py | |
parent | 423d05f6f59b24c91b9ef6b2e4ac130316764382 (diff) | |
download | cpython-git-84a13fbda0d79789e3c9efcc9f64752261ce1e8d.tar.gz |
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_wsgiref.py')
-rw-r--r-- | Lib/test/test_wsgiref.py | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/Lib/test/test_wsgiref.py b/Lib/test/test_wsgiref.py index 8422b308d7..737dfed3a5 100644 --- a/Lib/test/test_wsgiref.py +++ b/Lib/test/test_wsgiref.py @@ -338,6 +338,7 @@ class UtilityTests(TestCase): util.setup_testing_defaults(kw) self.assertEqual(util.request_uri(kw,query),uri) + @support.ignore_warnings(category=DeprecationWarning) def checkFW(self,text,size,match): def make_it(text=text,size=size): @@ -356,6 +357,13 @@ class UtilityTests(TestCase): it.close() self.assertTrue(it.filelike.closed) + def test_filewrapper_getitem_deprecation(self): + wrapper = util.FileWrapper(StringIO('foobar'), 3) + with self.assertWarnsRegex(DeprecationWarning, + r'Use iterator protocol instead'): + # This should have returned 'bar'. + self.assertEqual(wrapper[1], 'foo') + def testSimpleShifts(self): self.checkShift('','/', '', '/', '') self.checkShift('','/x', 'x', '/x', '') |