mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-27 13:12:45 +01:00
Removed utils.iter.one, which was dumb, because iterators have a .next() method that does the same thing.
This commit is contained in:
parent
6f8e3d37aa
commit
5b8400e158
@ -148,11 +148,6 @@ def ilen(iterable):
|
||||
i += 1
|
||||
return i
|
||||
|
||||
def one(iterable):
|
||||
for x in iterable:
|
||||
return x
|
||||
raise ValueError, 'Empty iterable: %r' % iterable
|
||||
|
||||
def startswith(long, short):
|
||||
longI = iter(long)
|
||||
shortI = iter(short)
|
||||
|
@ -384,14 +384,6 @@ class StrTest(SupyTestCase):
|
||||
|
||||
|
||||
class IterTest(SupyTestCase):
|
||||
def testOne(self):
|
||||
L = range(3)
|
||||
i = iter(L)
|
||||
self.assertEqual(utils.iter.one(i), 0)
|
||||
self.assertEqual(utils.iter.one(i), 1)
|
||||
self.assertEqual(utils.iter.one(i), 2)
|
||||
self.assertRaises(ValueError, utils.iter.one, i)
|
||||
|
||||
def testLimited(self):
|
||||
L = range(10)
|
||||
self.assertEqual([], list(utils.iter.limited(L, 0)))
|
||||
|
Loading…
Reference in New Issue
Block a user