aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/Lib/test/test_asyncio/utils.py
diff options
context:
space:
mode:
authorYury Selivanov <yury@magic.io>2017-12-18 17:03:23 -0500
committerGitHub <noreply@github.com>2017-12-18 17:03:23 -0500
commitd757aaf9dd767d13205bf9917e520ebf43e7f6e5 (patch)
tree2e0c92b2daf71cdf63c68a392e49aaa0a730daf7 /Lib/test/test_asyncio/utils.py
parent2d8f06382e7d5a759ca554110a699a397114824a (diff)
downloadcpython-d757aaf9dd767d13205bf9917e520ebf43e7f6e5.tar.gz
cpython-d757aaf9dd767d13205bf9917e520ebf43e7f6e5.zip
bpo-32356: idempotent pause_/resume_reading; new is_reading method. (#4914)
Diffstat (limited to 'Lib/test/test_asyncio/utils.py')
-rw-r--r--Lib/test/test_asyncio/utils.py17
1 files changed, 12 insertions, 5 deletions
diff --git a/Lib/test/test_asyncio/utils.py b/Lib/test/test_asyncio/utils.py
index a1a9bb3684c..eaafe3af8b8 100644
--- a/Lib/test/test_asyncio/utils.py
+++ b/Lib/test/test_asyncio/utils.py
@@ -327,12 +327,19 @@ class TestLoop(base_events.BaseEventLoop):
return False
def assert_reader(self, fd, callback, *args):
- assert fd in self.readers, 'fd {} is not registered'.format(fd)
+ if fd not in self.readers:
+ raise AssertionError(f'fd {fd} is not registered')
handle = self.readers[fd]
- assert handle._callback == callback, '{!r} != {!r}'.format(
- handle._callback, callback)
- assert handle._args == args, '{!r} != {!r}'.format(
- handle._args, args)
+ if handle._callback != callback:
+ raise AssertionError(
+ f'unexpected callback: {handle._callback} != {callback}')
+ if handle._args != args:
+ raise AssertionError(
+ f'unexpected callback args: {handle._args} != {args}')
+
+ def assert_no_reader(self, fd):
+ if fd in self.readers:
+ raise AssertionError(f'fd {fd} is registered')
def _add_writer(self, fd, callback, *args):
self.writers[fd] = events.Handle(callback, args, self)