I have programmed a small iterator in Python:
class anything(): def __init__(self): self.i=1 def __iter__(self): return self def next(self): if self.i>100: raise StopIteration self.i=self.i+1 return self.i
and I would like to use unittest of Python to check if some value on the generated list is even (I am just doing it for learning testing unit in Python). So I would like to have something like:
def main() for x in anything(): assert x%2==0
but I just do not know how to accomplish that. I have read some material online, but there are no examples that teach how to manage the unit test within classes.