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

Method test_error

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

Source from the content-addressed store, hash-verified

210
211 @support.cpython_only
212 def test_error(self):
213 class Loop(self._local):
214 attr = 1
215
216 # Trick the "if name == '__dict__':" test of __setattr__()
217 # to always be true
218 class NameCompareTrue:
219 def __eq__(self, other):
220 return True
221
222 loop = Loop()
223 with self.assertRaisesRegex(AttributeError, 'Loop.*read-only'):
224 loop.__setattr__(NameCompareTrue(), 2)
225
226
227class ThreadLocalTest(unittest.TestCase, BaseLocalTest):

Callers

nothing calls this directly

Calls 4

NameCompareTrueClass · 0.85
assertRaisesRegexMethod · 0.80
LoopClass · 0.70
__setattr__Method · 0.45

Tested by

no test coverage detected