Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(86163)

Unified Diff: Lib/test/_test_multiprocessing.py

Issue 16510: Using appropriate checks in tests
Patch Set: Created 5 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « Lib/test/test_module.py ('k') | Lib/test/test_os.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
--- a/Lib/test/_test_multiprocessing.py Fri Feb 07 17:53:13 2014 +0100
+++ b/Lib/test/_test_multiprocessing.py Fri Feb 07 23:40:05 2014 +0200
@@ -202,9 +202,9 @@
authkey = current.authkey
self.assertTrue(current.is_alive())
- self.assertTrue(not current.daemon)
+ self.assertFalse(current.daemon)
self.assertIsInstance(authkey, bytes)
- self.assertTrue(len(authkey) > 0)
+ self.assertGreater(len(authkey), 0)
self.assertEqual(current.ident, os.getpid())
self.assertEqual(current.exitcode, None)
@@ -247,7 +247,7 @@
self.assertEqual(p.is_alive(), False)
self.assertEqual(p.daemon, True)
self.assertNotIn(p, self.active_children())
- self.assertTrue(type(self.active_children()) is list)
+ self.assertIs(type(self.active_children()), list)
self.assertEqual(p.exitcode, None)
p.start()
@@ -330,8 +330,8 @@
cpus = multiprocessing.cpu_count()
except NotImplementedError:
cpus = 1
- self.assertTrue(type(cpus) is int)
- self.assertTrue(cpus >= 1)
+ self.assertIs(type(cpus), int)
+ self.assertGreaterEqual(cpus, 1)
def test_active_children(self):
self.assertEqual(type(self.active_children()), list)
@@ -1624,7 +1624,7 @@
del n.job
self.assertEqual(str(n), "Namespace(name='Bob')")
self.assertTrue(hasattr(n, 'name'))
- self.assertTrue(not hasattr(n, 'job'))
+ self.assertFalse(hasattr(n, 'job'))
#
#
@@ -2881,7 +2881,7 @@
def test_enable_logging(self):
logger = multiprocessing.get_logger()
logger.setLevel(util.SUBWARNING)
- self.assertTrue(logger is not None)
+ self.assertIsNotNone(logger)
logger.debug('this will not be printed')
logger.info('nor will this')
logger.setLevel(LOG_LEVEL)
@@ -3618,8 +3618,8 @@
if sys.platform == 'win32':
self.assertEqual(methods, ['spawn'])
else:
- self.assertTrue(methods == ['fork', 'spawn'] or
- methods == ['fork', 'spawn', 'forkserver'])
+ self.assertIn(methods, (['fork', 'spawn'],
+ ['fork', 'spawn', 'forkserver']))
#
# Check that killing process does not leak named semaphores
« no previous file with comments | « Lib/test/test_module.py ('k') | Lib/test/test_os.py » ('j') | no next file with comments »

RSS Feeds Recent Issues | This issue
This is Rietveld 894c83f36cb7+