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

Function test_first

t/unit/utils/test_functional.py:62–76  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

60
61
62def test_first():
63 iterations = [0]
64
65 def predicate(value):
66 iterations[0] += 1
67 if value == 5:
68 return True
69 return False
70
71 assert first(predicate, range(10)) == 5
72 assert iterations[0] == 6
73
74 iterations[0] = 0
75 assert first(predicate, range(10, 20)) is None
76 assert iterations[0] == 10
77
78
79def test_lookahead():

Callers

nothing calls this directly

Calls 1

firstFunction · 0.90

Tested by

no test coverage detected