@@ -24,14 +24,14 @@ def setUp(self):
2424
2525 def test_initlock (self ):
2626 #Make sure locks start locked
27- self .assertTrue ( not self .lock .locked (),
27+ self .assertFalse ( self .lock .locked (),
2828 "Lock object is not initialized unlocked." )
2929
3030 def test_release (self ):
3131 # Test self.lock.release()
3232 self .lock .acquire ()
3333 self .lock .release ()
34- self .assertTrue ( not self .lock .locked (),
34+ self .assertFalse ( self .lock .locked (),
3535 "Lock object did not release properly." )
3636
3737 def test_improper_release (self ):
@@ -46,7 +46,7 @@ def test_cond_acquire_success(self):
4646 def test_cond_acquire_fail (self ):
4747 #Test acquiring locked lock returns False
4848 self .lock .acquire (0 )
49- self .assertTrue ( not self .lock .acquire (0 ),
49+ self .assertFalse ( self .lock .acquire (0 ),
5050 "Conditional acquiring of a locked lock incorrectly "
5151 "succeeded." )
5252
@@ -58,9 +58,9 @@ def test_uncond_acquire_success(self):
5858
5959 def test_uncond_acquire_return_val (self ):
6060 #Make sure that an unconditional locking returns True.
61- self .assertTrue (self .lock .acquire (1 ) is True ,
61+ self .assertIs (self .lock .acquire (1 ), True ,
6262 "Unconditional locking did not return True." )
63- self .assertTrue (self .lock .acquire () is True )
63+ self .assertIs (self .lock .acquire (), True )
6464
6565 def test_uncond_acquire_blocking (self ):
6666 #Make sure that unconditional acquiring of a locked lock blocks.
@@ -80,7 +80,7 @@ def delay_unlock(to_unlock, delay):
8080 end_time = int (time .time ())
8181 if test_support .verbose :
8282 print "done"
83- self .assertTrue (( end_time - start_time ) >= DELAY ,
83+ self .assertGreaterEqual ( end_time - start_time , DELAY ,
8484 "Blocking by unconditional acquiring failed." )
8585
8686class MiscTests (unittest .TestCase ):
@@ -94,7 +94,7 @@ def test_ident(self):
9494 #Test sanity of _thread.get_ident()
9595 self .assertIsInstance (_thread .get_ident (), int ,
9696 "_thread.get_ident() returned a non-integer" )
97- self .assertTrue (_thread .get_ident () != 0 ,
97+ self .assertNotEqual (_thread .get_ident (), 0 ,
9898 "_thread.get_ident() returned 0" )
9999
100100 def test_LockType (self ):
@@ -164,7 +164,7 @@ def queue_mark(queue, delay):
164164 time .sleep (DELAY )
165165 if test_support .verbose :
166166 print 'done'
167- self .assertTrue (testing_queue .qsize () == thread_count ,
167+ self .assertEqual (testing_queue .qsize (), thread_count ,
168168 "Not all %s threads executed properly after %s sec." %
169169 (thread_count , DELAY ))
170170
0 commit comments