@@ -282,10 +282,10 @@ def test_find_prefix_at_end(self):
282
282
283
283
class TestFifo (unittest .TestCase ):
284
284
def test_basic (self ):
285
- with warnings . catch_warnings ( record = True ) as w :
285
+ with self . assertWarns ( DeprecationWarning ) as cm :
286
286
f = asynchat .fifo ()
287
- if w :
288
- assert issubclass ( w [ 0 ]. category , DeprecationWarning )
287
+ self . assertEqual ( str ( cm . warning ),
288
+ "fifo class will be removed in Python 3.6" )
289
289
f .push (7 )
290
290
f .push (b'a' )
291
291
self .assertEqual (len (f ), 2 )
@@ -300,10 +300,10 @@ def test_basic(self):
300
300
self .assertEqual (f .pop (), (0 , None ))
301
301
302
302
def test_given_list (self ):
303
- with warnings . catch_warnings ( record = True ) as w :
303
+ with self . assertWarns ( DeprecationWarning ) as cm :
304
304
f = asynchat .fifo ([b'x' , 17 , 3 ])
305
- if w :
306
- assert issubclass ( w [ 0 ]. category , DeprecationWarning )
305
+ self . assertEqual ( str ( cm . warning ),
306
+ "fifo class will be removed in Python 3.6" )
307
307
self .assertEqual (len (f ), 3 )
308
308
self .assertEqual (f .pop (), (1 , b'x' ))
309
309
self .assertEqual (f .pop (), (1 , 17 ))
0 commit comments