Returns a function that will return a random number between min_wait and max_wait. Example:: class MyUser(User): # wait between 3.0 and 10.5 seconds after each task wait_time = between(3.0, 10.5)
(min_wait: float, max_wait: float)
| 8 | |
| 9 | |
| 10 | def between(min_wait: float, max_wait: float) -> Callable[["User"], float]: |
| 11 | """ |
| 12 | Returns a function that will return a random number between min_wait and max_wait. |
| 13 | |
| 14 | Example:: |
| 15 | |
| 16 | class MyUser(User): |
| 17 | # wait between 3.0 and 10.5 seconds after each task |
| 18 | wait_time = between(3.0, 10.5) |
| 19 | """ |
| 20 | return lambda instance: min_wait + random.random() * (max_wait - min_wait) |
| 21 | |
| 22 | |
| 23 | def constant(wait_time: float) -> Callable[["User"], float]: |
no outgoing calls
no test coverage detected
searching dependent graphs…