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

Skip to content

Commit 76f43fc

Browse files
gh-60203: Always pass True/False as boolean arguments in tests (GH-99983)
Unless we explicitly test non-bool values.
1 parent bf26bdf commit 76f43fc

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
@@ -6042,5 +6042,5 @@ def test_semlock_subclass(self):
60426042
class SemLock(_multiprocessing.SemLock):
60436043
pass
60446044
name = f'test_semlock_subclass-{os.getpid()}'
6045-
s = SemLock(1, 0, 10, name, 0)
6045+
s = SemLock(1, 0, 10, name, False)
60466046
_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
@@ -559,7 +559,7 @@ def __index__(self):
559559
self.kwargs.clear()
560560
gc.collect()
561561
return 0
562-
x = IntWithDict(dont_inherit=IntWithDict())
562+
x = IntWithDict(optimize=IntWithDict())
563563
# We test the argument handling of "compile" here, the compilation
564564
# itself is not relevant. When we pass flags=x below, x.__index__() is
565565
# 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
@@ -138,16 +138,17 @@ def test_seq_bytes_to_charp_array(self):
138138
class Z(object):
139139
def __len__(self):
140140
return 1
141-
self.assertRaises(TypeError, _posixsubprocess.fork_exec,
142-
1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
141+
with self.assertRaisesRegex(TypeError, 'indexing'):
142+
_posixsubprocess.fork_exec(
143+
1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
143144
# Issue #15736: overflow in _PySequence_BytesToCharpArray()
144145
class Z(object):
145146
def __len__(self):
146147
return sys.maxsize
147148
def __getitem__(self, i):
148149
return b'x'
149150
self.assertRaises(MemoryError, _posixsubprocess.fork_exec,
150-
1,Z(),3,(1, 2),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23)
151+
1,Z(),True,(1, 2),5,6,7,8,9,10,11,12,13,14,True,True,17,False,19,20,21,22,False)
151152

152153
@unittest.skipUnless(_posixsubprocess, '_posixsubprocess required for this test.')
153154
def test_subprocess_fork_exec(self):
@@ -157,7 +158,7 @@ def __len__(self):
157158

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

162163
@unittest.skipIf(MISSING_C_DOCSTRINGS,
163164
"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)