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

Method test_derived

Lib/test/test_threading_local.py:56–74  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

54 self.assertIn(len(deadlist), (n-1, n), (n, len(deadlist)))
55
56 def test_derived(self):
57 # Issue 3088: if there is a threads switch inside the __init__
58 # of a threading.local derived class, the per-thread dictionary
59 # is created but not correctly set on the object.
60 # The first member set may be bogus.
61 import time
62 class Local(self._local):
63 def __init__(self):
64 time.sleep(0.01)
65 local = Local()
66
67 def f(i):
68 local.x = i
69 # Simply check that the variable is correctly set
70 self.assertEqual(local.x, i)
71
72 with threading_helper.start_threads(threading.Thread(target=f, args=(i,))
73 for i in range(10)):
74 pass
75
76 def test_derived_cycle_dealloc(self):
77 # http://bugs.python.org/issue6990

Callers

nothing calls this directly

Calls 1

LocalClass · 0.70

Tested by

no test coverage detected