Skip to content

Commit dfa715e

Browse files
committed
Add test to check that invalid 'args' input in the threading.Thread constructor.
1 parent 18249d9 commit dfa715e

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

Lib/test/test_threading.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -174,6 +174,21 @@ def test_args_argument(self):
174174
t.start()
175175
t.join()
176176

177+
def test_args_invalid_arguments_raises_typeerror(self):
178+
def task(x):
179+
pass
180+
181+
invalid_args = (
182+
"test string",
183+
1,
184+
b"Bytes"
185+
)
186+
187+
for args in invalid_args:
188+
with self.subTest(args=args):
189+
with self.assertRaises(TypeError):
190+
threading.Thread(target=task, args=args)
191+
177192
def test_lock_no_args(self):
178193
threading.Lock() # works
179194
self.assertRaises(TypeError, threading.Lock, 1)

0 commit comments

Comments
 (0)