MCPcopy Index your code
hub / github.com/python/cpython / test_signature

Method test_signature

Lib/test/test_threading.py:2322–2343  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

2320 locktype = staticmethod(threading._CRLock)
2321
2322 def test_signature(self): # gh-102029
2323 with warnings.catch_warnings(record=True) as warnings_log:
2324 threading.RLock()
2325 self.assertEqual(warnings_log, [])
2326
2327 arg_types = [
2328 ((1,), {}),
2329 ((), {'a': 1}),
2330 ((1, 2), {'a': 1}),
2331 ]
2332 for args, kwargs in arg_types:
2333 with self.subTest(args=args, kwargs=kwargs):
2334 self.assertRaises(TypeError, threading.RLock, *args, **kwargs)
2335
2336 # Subtypes with custom `__init__` are allowed (but, not recommended):
2337 class CustomRLock(self.locktype):
2338 def __init__(self, a, *, b) -> None:
2339 super().__init__()
2340
2341 with warnings.catch_warnings(record=True) as warnings_log:
2342 CustomRLock(1, b=2)
2343 self.assertEqual(warnings_log, [])
2344
2345class EventTests(lock_tests.EventTests):
2346 eventtype = staticmethod(threading.Event)

Callers

nothing calls this directly

Calls 5

CustomRLockClass · 0.85
RLockMethod · 0.80
assertEqualMethod · 0.45
subTestMethod · 0.45
assertRaisesMethod · 0.45

Tested by

no test coverage detected