Use functions to create generators in tests