May-11-2017, 09:55 AM
Hi folks,
I have the unittest that may run over some sequence, failing occasionally on some elements.
So, instead of writing
Thanks in advance
I have the unittest that may run over some sequence, failing occasionally on some elements.
So, instead of writing
class MyTectClass(unittest.TestCase): ..... def TestOverSequence(self): for elem in sequence: <run a bunch of asserts>I would like to have something like
class MyTectClass(unittest.TestCase): def __init__(self): super().__init__() self.sequence_iter = iter(sequence) def TestOverElem(self): elem = next(self.sequence_iter) <run a bunch of asserts>Is it doable, and if it is - how?
Thanks in advance