MCPcopy
hub / github.com/scrapy/scrapy / test_success_function

Method test_success_function

tests/test_utils_defer.py:32–45  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

30class TestMustbeDeferred:
31 @inline_callbacks_test
32 def test_success_function(self) -> Generator[Deferred[Any], Any, None]:
33 steps: list[int] = []
34
35 def _append(v: int) -> list[int]:
36 steps.append(v)
37 return steps
38
39 def _assert(v: list[int]) -> None:
40 assert v == [1, 2] # it is [1] with maybeDeferred
41
42 dfd = mustbe_deferred(_append, 1)
43 dfd.addCallback(_assert)
44 steps.append(2) # add another value, that should be caught by assertEqual
45 yield dfd
46
47 @inline_callbacks_test
48 def test_unfired_deferred(self) -> Generator[Deferred[Any], Any, None]:

Callers

nothing calls this directly

Calls 1

mustbe_deferredFunction · 0.90

Tested by

no test coverage detected