]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)
authorMiss Islington (bot) <31488909+miss-islington@users.noreply.github.com>
Sun, 4 Dec 2022 12:50:46 +0000 (04:50 -0800)
committerGitHub <noreply@github.com>
Sun, 4 Dec 2022 12:50:46 +0000 (04:50 -0800)
Unless we explicitly test non-bool values.
(cherry picked from commit 76f43fc09af29401cc0cec7710b03e4dbf8a4578)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
Lib/test/_test_multiprocessing.py
Lib/test/test_asyncio/test_ssl.py
Lib/test/test_call.py
Lib/test/test_capi/test_misc.py
Lib/test/test_subprocess.py

index 3117b110db0961b152a3d3297df47dacb732f8d1..b50a1543205cec970520683aeea93efe821de498 100644 (file)
@@ -6044,5 +6044,5 @@ class SemLockTests(unittest.TestCase):
         class SemLock(_multiprocessing.SemLock):
             pass
         name = f'test_semlock_subclass-{os.getpid()}'
-        s = SemLock(1, 0, 10, name, 0)
+        s = SemLock(1, 0, 10, name, False)
         _multiprocessing.sem_unlink(name)
index 5de9b7a14e87da3b66bb856e38264cfd73294139..aaf3c37101f52a66a9cc477c551ded5ae0ede1b9 100644 (file)
@@ -1689,7 +1689,7 @@ class TestThreadedServer(SocketThread):
     def run(self):
         try:
             with self._sock:
-                self._sock.setblocking(0)
+                self._sock.setblocking(False)
                 self._run()
         finally:
             self._s1.close()
index 4c971bc5ed05868fb4e7c5d4742aa17e9886020e..0974002a93b6e1364f5218b35420b48b9bb1a1a3 100644 (file)
@@ -558,7 +558,7 @@ class FastCallTests(unittest.TestCase):
                 self.kwargs.clear()
                 gc.collect()
                 return 0
-        x = IntWithDict(dont_inherit=IntWithDict())
+        x = IntWithDict(optimize=IntWithDict())
         # We test the argument handling of "compile" here, the compilation
         # itself is not relevant. When we pass flags=x below, x.__index__() is
         # called, which changes the keywords dict.
index b30b8d18d8aad0807ff7ce31ca46fb0d99bf2162..6cda91677054d7e5084e9f3ee83e6f87eea256f2 100644 (file)
@@ -139,8 +139,9 @@ class CAPITest(unittest.TestCase):
         class Z(object):
             def __len__(self):
                 return 1
-        self.assertRaises(TypeError, _posixsubprocess.fork_exec,
-                          1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+        with self.assertRaisesRegex(TypeError, 'indexing'):
+            _posixsubprocess.fork_exec(
+                          1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
         # Issue #15736: overflow in _PySequence_BytesToCharpArray()
         class Z(object):
             def __len__(self):
@@ -148,7 +149,7 @@ class CAPITest(unittest.TestCase):
             def __getitem__(self, i):
                 return b'x'
         self.assertRaises(MemoryError, _posixsubprocess.fork_exec,
-                          1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+                          1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
 
     @unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.')
     def test_subprocess_fork_exec(self):
@@ -158,7 +159,7 @@ class CAPITest(unittest.TestCase):
 
         # Issue #15738: crash in subprocess_fork_exec()
         self.assertRaises(TypeError, _posixsubprocess.fork_exec,
-                          Z(),[b'1'],3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
+                          Z(),[b'1'],True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
 
     @unittest.skipIf(MISSING_C_DOCSTRINGS,
                      "Signature information for builtins requires docstrings")
index 424a4a93b6f9722c51f1ae2cb82aac639a489d97..8713c73f87a0546e68e69ad4c167709b4336288d 100644 (file)
@@ -3209,7 +3209,7 @@ class POSIXProcessTestCase(BaseTestCase):
                         1, 2, 3, 4,
                         True, True, 0,
                         None, None, None, -1,
-                        None, "no vfork")
+                        None, True)
                 self.assertIn('fds_to_keep', str(c.exception))
         finally:
             if not gc_enabled: