summaryrefslogtreecommitdiff
path: root/tests/functional/b/bad_thread_instantiation.py
blob: 3c9aa5e55a281553e23239859a0b17792d86456f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# pylint: disable=missing-docstring, redundant-keyword-arg, invalid-name, line-too-long
import threading


threading.Thread(lambda: None).run()  # [bad-thread-instantiation]
threading.Thread(None, lambda: None)
threading.Thread(lambda: None, group=None)  # [bad-thread-instantiation]
threading.Thread()  # [bad-thread-instantiation]

threading.Thread(group=None, target=lambda: None).run()
threading.Thread(group=None, target=None, name=None, args=(), kwargs={})
threading.Thread(None, None, "name")

def thread_target(n):
    print(n ** 2)


thread = threading.Thread(thread_target, args=(10,))  # [bad-thread-instantiation]


kw = {'target_typo': lambda x: x}
threading.Thread(None, **kw)  # [unexpected-keyword-arg, bad-thread-instantiation]

threading.Thread(None, target_typo=lambda x: x)  # [unexpected-keyword-arg, bad-thread-instantiation]