(self)
| 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 | |
| 227 | class ThreadLocalTest(unittest.TestCase, BaseLocalTest): |
nothing calls this directly
no test coverage detected