diff options
| author | Serhiy Storchaka <storchaka@gmail.com> | 2022-04-24 07:23:59 (GMT) |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2022-04-24 07:23:59 (GMT) |
| commit | 090721721b373c50544d297b56c217cf15992cbe (patch) | |
| tree | eac831fb9a94fa4fec902c6dda217c60abfcc38d /Lib/test/test_asyncio/test_streams.py | |
| parent | b4e048411f4c62ad7343bca32c307f0bf5ef74b4 (diff) | |
| download | cpython-090721721b373c50544d297b56c217cf15992cbe.zip cpython-090721721b373c50544d297b56c217cf15992cbe.tar.gz cpython-090721721b373c50544d297b56c217cf15992cbe.tar.bz2 | |
Simplify testing the warning filename (GH-91868)
The context manager result has the "filename" attribute.
Diffstat (limited to 'Lib/test/test_asyncio/test_streams.py')
| -rw-r--r-- | Lib/test/test_asyncio/test_streams.py | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/Lib/test/test_asyncio/test_streams.py b/Lib/test/test_asyncio/test_streams.py index a7d1789..098a0da 100644 --- a/Lib/test/test_asyncio/test_streams.py +++ b/Lib/test/test_asyncio/test_streams.py @@ -813,7 +813,7 @@ os.close(fd) with self.assertWarns(DeprecationWarning) as cm: with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'): asyncio.StreamReader() - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_streamreader_constructor_use_running_loop(self): # asyncio issue #184: Ensure that StreamReaderProtocol constructor @@ -832,7 +832,7 @@ os.close(fd) asyncio.set_event_loop(self.loop) with self.assertWarns(DeprecationWarning) as cm: reader = asyncio.StreamReader() - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertIs(reader._loop, self.loop) @@ -841,7 +841,7 @@ os.close(fd) with self.assertWarns(DeprecationWarning) as cm: with self.assertRaisesRegex(RuntimeError, 'There is no current event loop'): asyncio.StreamReaderProtocol(reader) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) def test_streamreaderprotocol_constructor_use_running_loop(self): # asyncio issue #184: Ensure that StreamReaderProtocol constructor @@ -861,7 +861,7 @@ os.close(fd) reader = mock.Mock() with self.assertWarns(DeprecationWarning) as cm: protocol = asyncio.StreamReaderProtocol(reader) - self.assertEqual(cm.warnings[0].filename, __file__) + self.assertEqual(cm.filename, __file__) self.assertIs(protocol._loop, self.loop) def test_drain_raises(self): |
