Hi folks,
I have the unittest that may run over some sequence, failing occasionally on some elements.
So, instead of writing
I would like to have something like
Is it doable, and if it is - how?
Thanks in advance
I have the unittest that may run over some sequence, failing occasionally on some elements.
So, instead of writing
1 2 3 4 5 |
class MyTectClass(unittest.TestCase): ..... def TestOverSequence( self ): for elem in sequence: <run a bunch of asserts> |
1 2 3 4 5 6 7 8 |
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> |
Thanks in advance
Test everything in a Python shell (iPython, Azure Notebook, etc.)
- Someone gave you an advice you liked? Test it - maybe the advice was actually bad.
- Someone gave you an advice you think is bad? Test it before arguing - maybe it was good.
- You posted a claim that something you did not test works? Be prepared to eat your hat.