summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_asyncio/test_events.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2013-11-14 21:10:51 (GMT)
committerSerhiy Storchaka <storchaka@gmail.com>2013-11-14 21:10:51 (GMT)
commite048addedc4c54f3904069f154b3632da65d820b (patch)
treec73ff3b73c513f7c977aa866ab350e1708b5bd80 /Lib/test/test_asyncio/test_events.py
parentf38f7f3c7b8b018428a427c33ada455ec09683ca (diff)
downloadcpython-e048addedc4c54f3904069f154b3632da65d820b.zip
cpython-e048addedc4c54f3904069f154b3632da65d820b.tar.gz
cpython-e048addedc4c54f3904069f154b3632da65d820b.tar.bz2
Issue #19589: Use specific asserts in asyncio tests.
Diffstat (limited to 'Lib/test/test_asyncio/test_events.py')
-rw-r--r--Lib/test/test_asyncio/test_events.py18
1 files changed, 10 insertions, 8 deletions
diff --git a/Lib/test/test_asyncio/test_events.py b/Lib/test/test_asyncio/test_events.py
index 7b9839c..2338546 100644
--- a/Lib/test/test_asyncio/test_events.py
+++ b/Lib/test/test_asyncio/test_events.py
@@ -472,8 +472,8 @@ class EventLoopTestsMixin:
f = self.loop.create_connection(
lambda: MyProto(loop=self.loop), *httpd.address)
tr, pr = self.loop.run_until_complete(f)
- self.assertTrue(isinstance(tr, transports.Transport))
- self.assertTrue(isinstance(pr, protocols.Protocol))
+ self.assertIsInstance(tr, transports.Transport)
+ self.assertIsInstance(pr, protocols.Protocol)
self.loop.run_until_complete(pr.done)
self.assertGreater(pr.nbytes, 0)
tr.close()
@@ -500,8 +500,8 @@ class EventLoopTestsMixin:
f = self.loop.create_connection(
lambda: MyProto(loop=self.loop), sock=sock)
tr, pr = self.loop.run_until_complete(f)
- self.assertTrue(isinstance(tr, transports.Transport))
- self.assertTrue(isinstance(pr, protocols.Protocol))
+ self.assertIsInstance(tr, transports.Transport)
+ self.assertIsInstance(pr, protocols.Protocol)
self.loop.run_until_complete(pr.done)
self.assertGreater(pr.nbytes, 0)
tr.close()
@@ -513,8 +513,8 @@ class EventLoopTestsMixin:
lambda: MyProto(loop=self.loop), *httpd.address,
ssl=test_utils.dummy_ssl_context())
tr, pr = self.loop.run_until_complete(f)
- self.assertTrue(isinstance(tr, transports.Transport))
- self.assertTrue(isinstance(pr, protocols.Protocol))
+ self.assertIsInstance(tr, transports.Transport)
+ self.assertIsInstance(pr, protocols.Protocol)
self.assertTrue('ssl' in tr.__class__.__name__.lower())
self.assertIsNotNone(tr.get_extra_info('sockname'))
self.loop.run_until_complete(pr.done)
@@ -926,7 +926,8 @@ class EventLoopTestsMixin:
r.setblocking(False)
f = self.loop.sock_recv(r, 1)
ov = getattr(f, 'ov', None)
- self.assertTrue(ov is None or ov.pending)
+ if ov is not None:
+ self.assertTrue(ov.pending)
@tasks.coroutine
def main():
@@ -949,7 +950,8 @@ class EventLoopTestsMixin:
self.assertLess(elapsed, 0.1)
self.assertEqual(t.result(), 'cancelled')
self.assertRaises(futures.CancelledError, f.result)
- self.assertTrue(ov is None or not ov.pending)
+ if ov is not None:
+ self.assertFalse(ov.pending)
self.loop._stop_serving(r)
r.close()