MCPcopy
hub / github.com/celery/celery / test_callbacks

Method test_callbacks

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

Source from the content-addressed store, hash-verified

309 assert X.evals == 1
310
311 def test_callbacks(self):
312 source = Mock(name='source')
313 p = PromiseProxy(source)
314 cbA = Mock(name='cbA')
315 cbB = Mock(name='cbB')
316 cbC = Mock(name='cbC')
317 p.__then__(cbA, p)
318 p.__then__(cbB, p)
319 assert not p.__evaluated__()
320 assert object.__getattribute__(p, '__pending__')
321
322 assert repr(p)
323 assert p.__evaluated__()
324 with pytest.raises(AttributeError):
325 object.__getattribute__(p, '__pending__')
326 cbA.assert_called_with(p)
327 cbB.assert_called_with(p)
328
329 assert p.__evaluated__()
330 p.__then__(cbC, p)
331 cbC.assert_called_with(p)
332
333 with pytest.raises(AttributeError):
334 object.__getattribute__(p, '__pending__')
335
336 def test_maybe_evaluate(self):
337 x = PromiseProxy(lambda: 30)

Callers

nothing calls this directly

Calls 5

__then__Method · 0.95
__evaluated__Method · 0.95
PromiseProxyClass · 0.90
__getattribute__Method · 0.80
raisesMethod · 0.45

Tested by

no test coverage detected