Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 7aa87bb

Browse files
gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)
Unless we explicitly test non-bool values. (cherry picked from commit 76f43fc) Co-authored-by: Serhiy Storchaka <[email protected]>
1 parent 9e38553 commit 7aa87bb

File tree

5 files changed

+9
-8
lines changed

5 files changed

+9
-8
lines changed

Lib/test/_test_multiprocessing.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6044,5 +6044,5 @@ def test_semlock_subclass(self):
60446044
class SemLock(_multiprocessing.SemLock):
60456045
pass
60466046
name = f'test_semlock_subclass-{os.getpid()}'
6047-
s = SemLock(1, 0, 10, name, 0)
6047+
s = SemLock(1, 0, 10, name, False)
60486048
_multiprocessing.sem_unlink(name)

Lib/test/test_asyncio/test_ssl.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1689,7 +1689,7 @@ def stop(self):
16891689
def run(self):
16901690
try:
16911691
with self._sock:
1692-
self._sock.setblocking(0)
1692+
self._sock.setblocking(False)
16931693
self._run()
16941694
finally:
16951695
self._s1.close()

Lib/test/test_call.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ def __index__(self):
558558
self.kwargs.clear()
559559
gc.collect()
560560
return 0
561-
x = IntWithDict(dont_inherit=IntWithDict())
561+
x = IntWithDict(optimize=IntWithDict())
562562
# We test the argument handling of "compile" here, the compilation
563563
# itself is not relevant. When we pass flags=x below, x.__index__() is
564564
# called, which changes the keywords dict.

Lib/test/test_capi/test_misc.py

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -139,16 +139,17 @@ def test_seq_bytes_to_charp_array(self):
139139
class Z(object):
140140
def __len__(self):
141141
return 1
142-
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
143-
1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
142+
with self.assertRaisesRegex(TypeError, 'indexing'):
143+
_posixsubprocess.fork_exec(
144+
1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
144145
# Issue #15736: overflow in _PySequence_BytesToCharpArray()
145146
class Z(object):
146147
def __len__(self):
147148
return sys.maxsize
148149
def __getitem__(self, i):
149150
return b'x'
150151
self.assertRaises(MemoryError, _posixsubprocess.fork_exec,
151-
1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
152+
1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
152153

153154
@unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.')
154155
def test_subprocess_fork_exec(self):
@@ -158,7 +159,7 @@ def __len__(self):
158159

159160
# Issue #15738: crash in subprocess_fork_exec()
160161
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
161-
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)
162+
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)
162163

163164
@unittest.skipIf(MISSING_C_DOCSTRINGS,
164165
"Signature information for builtins requires docstrings")

Lib/test/test_subprocess.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3209,7 +3209,7 @@ def __int__(self):
32093209
1, 2, 3, 4,
32103210
True, True, 0,
32113211
None, None, None, -1,
3212-
None, "no vfork")
3212+
None, True)
32133213
self.assertIn('fds_to_keep', str(c.exception))
32143214
finally:
32153215
if not gc_enabled:

0 commit comments

Comments
 (0)