diff options
author | Andrew Svetlov <andrew.svetlov@gmail.com> | 2020-02-01 11:12:52 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-02-01 11:12:52 (GMT) |
commit | 90d9ba6ef10af32e8dfe0649789c3a8ccf419e95 (patch) | |
tree | 5cd3e31fa3f1508ff72bfa0991bcdd8eeb9e3259 /Lib/test/test_asyncio/test_pep492.py | |
parent | abb9a448dee3e18c69080231fbeba980bf048211 (diff) | |
download | cpython-90d9ba6ef10af32e8dfe0649789c3a8ccf419e95.zip cpython-90d9ba6ef10af32e8dfe0649789c3a8ccf419e95.tar.gz cpython-90d9ba6ef10af32e8dfe0649789c3a8ccf419e95.tar.bz2 |
bpo-34793: Drop old-style context managers in asyncio.locks (GH-17533)
Diffstat (limited to 'Lib/test/test_asyncio/test_pep492.py')
-rw-r--r-- | Lib/test/test_asyncio/test_pep492.py | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/Lib/test/test_asyncio/test_pep492.py b/Lib/test/test_asyncio/test_pep492.py index a1f27dd..c5e3a5c 100644 --- a/Lib/test/test_asyncio/test_pep492.py +++ b/Lib/test/test_asyncio/test_pep492.py @@ -77,13 +77,12 @@ class LockTests(BaseTest): async def test(lock): await asyncio.sleep(0.01) self.assertFalse(lock.locked()) - with self.assertWarns(DeprecationWarning): - with await lock as _lock: - self.assertIs(_lock, None) - self.assertTrue(lock.locked()) - await asyncio.sleep(0.01) - self.assertTrue(lock.locked()) - self.assertFalse(lock.locked()) + with self.assertRaisesRegex( + TypeError, + "can't be used in 'await' expression" + ): + with await lock: + pass for primitive in primitives: self.loop.run_until_complete(test(primitive)) |