source: utilitiespy/test/tools/IteratorTest.py@ 1214

Last change on this file since 1214 was 1176, checked in by wouter, 3 months ago

#371 added enum tools, rev. 1.1.0

File size: 380 bytes
RevLine 
[667]1import unittest
2from tudelft.utilities.listener.DefaultListenable import DefaultListenable
3from tudelft.utilities.tools.Iterator import hasNext
4
[1176]5class IteratorTest(unittest.TestCase):
[667]6
7 def test_Iterator(self):
8 it=iter([1,2,3])
9 result=[]
10 while (t:=hasNext(it)) and (it:=t[1]) and t[0]:
11 nxt=next(it)
12 print(nxt)
13 result.append(nxt)
14 self.assertEqual(3, len(result))
Note: See TracBrowser for help on using the repository browser.