MCPcopy Create free account
hub / github.com/MagicStack/contextvars / test_context_run_5

Method test_context_run_5

tests/test_basics.py:167–179  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

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()

Callers

nothing calls this directly

Calls 2

runMethod · 0.95
getMethod · 0.95

Tested by

no test coverage detected