MCPcopy Index your code
hub / github.com/RustPython/RustPython / test_derived

Method test_derived

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 1

LocalClass · 0.70

Tested by

no test coverage detected