I have a function that takes an Iterable as an argument:
def print_me(vals: Iterable[str]) -> None:
...
It gets called with a generator:
def run():
print_me((str(i) for i in range(10)))
I'd like to patch and mock print_me() and verify it gets called with specific parameters. With plain old lists, this is easy:
mock.assert_called_with(["0", "1", ...])
but with a generator, because it can't be matched on equality or replayed, this is trickier.