@@ -319,7 +319,7 @@ def test_current(self):
319319        authkey  =  current .authkey 
320320
321321        self .assertTrue (current .is_alive ())
322-         self .assertTrue ( not   current .daemon )
322+         self .assertFalse ( current .daemon )
323323        self .assertIsInstance (authkey , bytes )
324324        self .assertTrue (len (authkey ) >  0 )
325325        self .assertEqual (current .ident , os .getpid ())
@@ -463,7 +463,7 @@ def test_process(self):
463463        self .assertEqual (p .is_alive (), False )
464464        self .assertEqual (p .daemon , True )
465465        self .assertNotIn (p , self .active_children ())
466-         self .assertTrue (type (self .active_children ())  is  list )
466+         self .assertIs (type (self .active_children ()),  list )
467467        self .assertEqual (p .exitcode , None )
468468
469469        p .start ()
@@ -583,8 +583,8 @@ def test_cpu_count(self):
583583            cpus  =  multiprocessing .cpu_count ()
584584        except  NotImplementedError :
585585            cpus  =  1 
586-         self .assertTrue ( type ( cpus )  is  int )
587-         self .assertTrue (cpus   >=  1 )
586+         self .assertIsInstance ( cpus ,  int )
587+         self .assertGreaterEqual (cpus ,  1 )
588588
589589    def  test_active_children (self ):
590590        self .assertEqual (type (self .active_children ()), list )
@@ -2382,14 +2382,14 @@ def test_getobj_getlock(self):
23822382        self .assertEqual (lock , lock3 )
23832383
23842384        arr4  =  self .Value ('i' , 5 , lock = False )
2385-         self .assertFalse ( hasattr ( arr4 , 'get_lock' ) )
2386-         self .assertFalse ( hasattr ( arr4 , 'get_obj' ) )
2385+         self .assertNotHasAttr ( arr4 , 'get_lock' )
2386+         self .assertNotHasAttr ( arr4 , 'get_obj' )
23872387
23882388        self .assertRaises (AttributeError , self .Value , 'i' , 5 , lock = 'navalue' )
23892389
23902390        arr5  =  self .RawValue ('i' , 5 )
2391-         self .assertFalse ( hasattr ( arr5 , 'get_lock' ) )
2392-         self .assertFalse ( hasattr ( arr5 , 'get_obj' ) )
2391+         self .assertNotHasAttr ( arr5 , 'get_lock' )
2392+         self .assertNotHasAttr ( arr5 , 'get_obj' )
23932393
23942394
23952395class  _TestArray (BaseTestCase ):
@@ -2462,14 +2462,14 @@ def test_getobj_getlock_obj(self):
24622462        self .assertEqual (lock , lock3 )
24632463
24642464        arr4  =  self .Array ('i' , range (10 ), lock = False )
2465-         self .assertFalse ( hasattr ( arr4 , 'get_lock' ) )
2466-         self .assertFalse ( hasattr ( arr4 , 'get_obj' ) )
2465+         self .assertNotHasAttr ( arr4 , 'get_lock' )
2466+         self .assertNotHasAttr ( arr4 , 'get_obj' )
24672467        self .assertRaises (AttributeError ,
24682468                          self .Array , 'i' , range (10 ), lock = 'notalock' )
24692469
24702470        arr5  =  self .RawArray ('i' , range (10 ))
2471-         self .assertFalse ( hasattr ( arr5 , 'get_lock' ) )
2472-         self .assertFalse ( hasattr ( arr5 , 'get_obj' ) )
2471+         self .assertNotHasAttr ( arr5 , 'get_lock' )
2472+         self .assertNotHasAttr ( arr5 , 'get_obj' )
24732473
24742474# 
24752475# 
@@ -2657,8 +2657,8 @@ def test_namespace(self):
26572657        self .assertEqual ((n .name , n .job ), ('Bob' , 'Builder' ))
26582658        del  n .job 
26592659        self .assertEqual (str (n ), "Namespace(name='Bob')" )
2660-         self .assertTrue ( hasattr ( n , 'name' ) )
2661-         self .assertTrue ( not   hasattr ( n , 'job' ) )
2660+         self .assertHasAttr ( n , 'name' )
2661+         self .assertNotHasAttr ( n , 'job' )
26622662
26632663# 
26642664# 
@@ -4938,13 +4938,9 @@ def test_import(self):
49384938        for  name  in  modules :
49394939            __import__ (name )
49404940            mod  =  sys .modules [name ]
4941-             self .assertTrue (hasattr (mod , '__all__' ), name )
4942- 
4941+             self .assertHasAttr (mod , '__all__' , name )
49434942            for  attr  in  mod .__all__ :
4944-                 self .assertTrue (
4945-                     hasattr (mod , attr ),
4946-                     '%r does not have attribute %r'  %  (mod , attr )
4947-                     )
4943+                 self .assertHasAttr (mod , attr )
49484944
49494945# 
49504946# Quick test that logging works -- does not test logging output 
@@ -4957,7 +4953,7 @@ class _TestLogging(BaseTestCase):
49574953    def  test_enable_logging (self ):
49584954        logger  =  multiprocessing .get_logger ()
49594955        logger .setLevel (util .SUBWARNING )
4960-         self .assertTrue (logger   is   not   None )
4956+         self .assertIsNotNone (logger )
49614957        logger .debug ('this will not be printed' )
49624958        logger .info ('nor will this' )
49634959        logger .setLevel (LOG_LEVEL )
@@ -5753,9 +5749,8 @@ def test_set_get(self):
57535749                self .assertEqual (multiprocessing .get_start_method (), method )
57545750                ctx  =  multiprocessing .get_context ()
57555751                self .assertEqual (ctx .get_start_method (), method )
5756-                 self .assertTrue (type (ctx ).__name__ .lower ().startswith (method ))
5757-                 self .assertTrue (
5758-                     ctx .Process .__name__ .lower ().startswith (method ))
5752+                 self .assertStartsWith (type (ctx ).__name__ .lower (), method )
5753+                 self .assertStartsWith (ctx .Process .__name__ .lower (), method )
57595754                self .check_context (multiprocessing )
57605755                count  +=  1 
57615756        finally :
@@ -5956,9 +5951,9 @@ def check_resource_tracker_death(self, signum, should_die):
59565951            if  should_die :
59575952                self .assertEqual (len (all_warn ), 1 )
59585953                the_warn  =  all_warn [0 ]
5959-                 self .assertTrue ( issubclass ( the_warn .category , UserWarning ) )
5960-                 self .assertTrue ("resource_tracker: process died" 
5961-                                  in   str (the_warn .message ))
5954+                 self .assertIsSubclass ( the_warn .category , UserWarning )
5955+                 self .assertIn ("resource_tracker: process died" , 
5956+                               str (the_warn .message ))
59625957            else :
59635958                self .assertEqual (len (all_warn ), 0 )
59645959
@@ -6163,8 +6158,8 @@ def is_alive(self):
61636158                Process = FailingForkProcess ))
61646159            p .close ()
61656160            p .join ()
6166-         self . assertFalse ( 
6167-             any (process .is_alive ()  for   process   in   forked_processes ) )
6161+         for   process   in   forked_processes : 
6162+             self . assertFalse (process .is_alive (),  process )
61686163
61696164
61706165@hashlib_helper .requires_hashdigest ('sha256' ) 
0 commit comments