(self)
| 165 | self.assertIn(var, returned_ctx) |
| 166 | |
| 167 | def test_context_run_5(self): |
| 168 | ctx = contextvars.Context() |
| 169 | var = contextvars.ContextVar('var') |
| 170 | |
| 171 | def func(): |
| 172 | self.assertIsNone(var.get(None)) |
| 173 | var.set('spam') |
| 174 | 1 / 0 |
| 175 | |
| 176 | with self.assertRaises(ZeroDivisionError): |
| 177 | ctx.run(func) |
| 178 | |
| 179 | self.assertIsNone(var.get(None)) |
| 180 | |
| 181 | def test_context_run_6(self): |
| 182 | ctx = contextvars.Context() |