Last change
on this file since 1080 was 667, checked in by wouter, 11 months ago |
added tools to utilities package to include tools for java2python translator
|
File size:
389 bytes
|
Line | |
---|
1 | import unittest
|
---|
2 | from tudelft.utilities.listener.DefaultListenable import DefaultListenable
|
---|
3 | from tudelft.utilities.tools.Iterator import hasNext
|
---|
4 |
|
---|
5 | class DefaultListenableTest(unittest.TestCase):
|
---|
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.