MCPcopy Create free account
hub / github.com/celery/celery / test_context

Method test_context

t/unit/utils/test_local.py:265–282  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

263 assert Proxy(lambda: X())() == 1234
264
265 def test_context(self):
266
267 class X:
268 entered = exited = False
269
270 def __enter__(self):
271 self.entered = True
272 return 1234
273
274 def __exit__(self, *exc_info):
275 self.exited = True
276
277 v = X()
278 x = Proxy(lambda: v)
279 with x as val:
280 assert val == 1234
281 assert x.entered
282 assert x.exited
283
284 def test_reduce(self):
285

Callers

nothing calls this directly

Calls 2

ProxyClass · 0.90
XClass · 0.70

Tested by

no test coverage detected