@@ -50,7 +50,7 @@ def _basetest_open_connection(self, open_connection_fut):
5050 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
5151 f = reader .read ()
5252 data = self .loop .run_until_complete (f )
53- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
53+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
5454 writer .close ()
5555 self .assertEqual (messages , [])
5656
@@ -75,7 +75,7 @@ def _basetest_open_connection_no_loop_ssl(self, open_connection_fut):
7575 writer .write (b'GET / HTTP/1.0\r \n \r \n ' )
7676 f = reader .read ()
7777 data = self .loop .run_until_complete (f )
78- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
78+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
7979
8080 writer .close ()
8181 self .assertEqual (messages , [])
@@ -1002,7 +1002,7 @@ def test_wait_closed_on_close(self):
10021002 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
10031003 f = rd .read ()
10041004 data = self .loop .run_until_complete (f )
1005- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
1005+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
10061006 self .assertFalse (wr .is_closing ())
10071007 wr .close ()
10081008 self .assertTrue (wr .is_closing ())
@@ -1028,7 +1028,7 @@ async def inner(httpd):
10281028 data = await rd .readline ()
10291029 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
10301030 data = await rd .read ()
1031- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
1031+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
10321032 wr .close ()
10331033 await wr .wait_closed ()
10341034
@@ -1048,7 +1048,7 @@ async def inner(httpd):
10481048 data = await rd .readline ()
10491049 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
10501050 data = await rd .read ()
1051- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
1051+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
10521052 wr .close ()
10531053 with self .assertRaises (ConnectionResetError ):
10541054 wr .write (b'data' )
@@ -1089,12 +1089,12 @@ async def inner(httpd):
10891089 data = await rd .readline ()
10901090 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
10911091 data = await rd .read ()
1092- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
1092+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
10931093 with self .assertWarns (ResourceWarning ) as cm :
10941094 del wr
10951095 gc .collect ()
10961096 self .assertEqual (len (cm .warnings ), 1 )
1097- self .assertTrue (str (cm .warnings [0 ].message ). startswith ( "unclosed <StreamWriter" ) )
1097+ self .assertStartsWith (str (cm .warnings [0 ].message ), "unclosed <StreamWriter" )
10981098
10991099 messages = []
11001100 self .loop .set_exception_handler (lambda loop , ctx : messages .append (ctx ))
@@ -1112,7 +1112,7 @@ async def inner(httpd):
11121112 data = await rd .readline ()
11131113 self .assertEqual (data , b'HTTP/1.0 200 OK\r \n ' )
11141114 data = await rd .read ()
1115- self .assertTrue (data . endswith ( b'\r \n \r \n Test message' ) )
1115+ self .assertEndsWith (data , b'\r \n \r \n Test message' )
11161116
11171117 # Make "loop is closed" occur first before "del wr" for this test.
11181118 self .loop .stop ()
@@ -1144,7 +1144,7 @@ async def inner(rd, wr):
11441144 del wr
11451145 gc .collect ()
11461146 self .assertEqual (len (cm .warnings ), 1 )
1147- self .assertTrue (str (cm .warnings [0 ].message ). startswith ( "unclosed <StreamWriter" ) )
1147+ self .assertStartsWith (str (cm .warnings [0 ].message ), "unclosed <StreamWriter" )
11481148
11491149 async def outer ():
11501150 srv = await asyncio .start_server (inner , socket_helper .HOSTv4 , 0 )
0 commit comments