def want_return_eq_5(bofunc): '''Repeat until function returns 5. ''' return repeat_until_satisfied(return_value_is_5, bad_outcome = bofunc)
def test_report(reportfunc): '''Repeat until function returns 5. ''' return repeat_until_satisfied(return_value_is_5, report = reportfunc)
def test_end_of_loop(eolfunc): '''Repeat until function returns 5. ''' return repeat_until_satisfied(return_value_is_5, end_of_loop = eolfunc)
def setUp(self): self.ok = lambda r: r < 2 self.try_hard = repeat_until_satisfied(self.ok, bad_outcome = bob)