bpo-23819: asyncio: Replace AssertionError with TypeError where it makes sense (GH-29894)

This commit is contained in:
Kumar Aditya 2021-12-07 05:10:35 +05:30 committed by GitHub
parent 8518ee348c
commit 265918bb1d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 15 additions and 9 deletions

View file

@ -255,6 +255,8 @@ class BaseEventLoopTests(test_utils.TestCase):
self.assertIsInstance(h, asyncio.TimerHandle)
self.assertIn(h, self.loop._scheduled)
self.assertNotIn(h, self.loop._ready)
with self.assertRaises(TypeError, msg="delay must not be None"):
self.loop.call_later(None, cb)
def test_call_later_negative_delays(self):
calls = []
@ -286,6 +288,8 @@ class BaseEventLoopTests(test_utils.TestCase):
# tolerate a difference of +800 ms because some Python buildbots
# are really slow
self.assertLessEqual(dt, 0.9, dt)
with self.assertRaises(TypeError, msg="when cannot be None"):
self.loop.call_at(None, cb)
def check_thread(self, loop, debug):
def cb():