Skip to content

Commit c2fb19f

Browse files
committed
-
1 parent 4cce436 commit c2fb19f

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

source_py3/test_python_toolbox/test_cute_iter_tools/test_shorten.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
import nose.tools
77

8+
from python_toolbox import nifty_collections
89
from python_toolbox import cute_iter_tools
910
from python_toolbox.cute_iter_tools import shorten
1011

@@ -29,6 +30,16 @@ def test():
2930
assert list(shorten(iter(my_range), infinity)) == my_range
3031

3132

33+
def test_lazy_tuple():
34+
my_range = [0, 1, 2, 3, 4]
35+
36+
lazy_tuple = shorten(my_range, 3, lazy_tuple=True)
37+
assert isinstance(lazy_tuple, nifty_collections.LazyTuple)
38+
assert not lazy_tuple.collected_data
39+
40+
assert tuple(lazy_tuple) == (0, 1, 2)
41+
42+
3243
def test_dont_pull_extra_item():
3344
'''Test that `shorten` doesn't pull an extra member from the iterable.'''
3445
def generator():

0 commit comments

Comments
 (0)