@@ -472,8 +472,8 @@ def test_create_connection(self):
472
472
f = self .loop .create_connection (
473
473
lambda : MyProto (loop = self .loop ), * httpd .address )
474
474
tr , pr = self .loop .run_until_complete (f )
475
- self .assertTrue ( isinstance ( tr , transports .Transport ) )
476
- self .assertTrue ( isinstance ( pr , protocols .Protocol ) )
475
+ self .assertIsInstance ( tr , transports .Transport )
476
+ self .assertIsInstance ( pr , protocols .Protocol )
477
477
self .loop .run_until_complete (pr .done )
478
478
self .assertGreater (pr .nbytes , 0 )
479
479
tr .close ()
@@ -500,8 +500,8 @@ def test_create_connection_sock(self):
500
500
f = self .loop .create_connection (
501
501
lambda : MyProto (loop = self .loop ), sock = sock )
502
502
tr , pr = self .loop .run_until_complete (f )
503
- self .assertTrue ( isinstance ( tr , transports .Transport ) )
504
- self .assertTrue ( isinstance ( pr , protocols .Protocol ) )
503
+ self .assertIsInstance ( tr , transports .Transport )
504
+ self .assertIsInstance ( pr , protocols .Protocol )
505
505
self .loop .run_until_complete (pr .done )
506
506
self .assertGreater (pr .nbytes , 0 )
507
507
tr .close ()
@@ -513,8 +513,8 @@ def test_create_ssl_connection(self):
513
513
lambda : MyProto (loop = self .loop ), * httpd .address ,
514
514
ssl = test_utils .dummy_ssl_context ())
515
515
tr , pr = self .loop .run_until_complete (f )
516
- self .assertTrue ( isinstance ( tr , transports .Transport ) )
517
- self .assertTrue ( isinstance ( pr , protocols .Protocol ) )
516
+ self .assertIsInstance ( tr , transports .Transport )
517
+ self .assertIsInstance ( pr , protocols .Protocol )
518
518
self .assertTrue ('ssl' in tr .__class__ .__name__ .lower ())
519
519
self .assertIsNotNone (tr .get_extra_info ('sockname' ))
520
520
self .loop .run_until_complete (pr .done )
@@ -926,7 +926,8 @@ def test_prompt_cancellation(self):
926
926
r .setblocking (False )
927
927
f = self .loop .sock_recv (r , 1 )
928
928
ov = getattr (f , 'ov' , None )
929
- self .assertTrue (ov is None or ov .pending )
929
+ if ov is not None :
930
+ self .assertTrue (ov .pending )
930
931
931
932
@tasks .coroutine
932
933
def main ():
@@ -949,7 +950,8 @@ def main():
949
950
self .assertLess (elapsed , 0.1 )
950
951
self .assertEqual (t .result (), 'cancelled' )
951
952
self .assertRaises (futures .CancelledError , f .result )
952
- self .assertTrue (ov is None or not ov .pending )
953
+ if ov is not None :
954
+ self .assertFalse (ov .pending )
953
955
self .loop ._stop_serving (r )
954
956
955
957
r .close ()
0 commit comments