import unittest from tudelft.utilities.listener.DefaultListenable import DefaultListenable from tudelft.utilities.tools.Iterator import hasNext class DefaultListenableTest(unittest.TestCase): def test_Iterator(self): it=iter([1,2,3]) result=[] while (t:=hasNext(it)) and (it:=t[1]) and t[0]: nxt=next(it) print(nxt) result.append(nxt) self.assertEqual(3, len(result))