summaryrefslogtreecommitdiff
path: root/test_six.py
diff options
context:
space:
mode:
authorBenjamin Peterson <benjamin@python.org>2011-06-19 17:44:24 -0500
committerBenjamin Peterson <benjamin@python.org>2011-06-19 17:44:24 -0500
commite95cae7fdaf4209ce6de38bd159b4ec1247425fa (patch)
tree9c06586ddff952b9f06014fe8196326bf5fa10f3 /test_six.py
parent224c54b9d1013662df2aacf79161857833eff390 (diff)
downloadsix-e95cae7fdaf4209ce6de38bd159b4ec1247425fa.tar.gz
add six.moves mappings for filter, map, and zip (fixes issue #3)
six.moves.(filter|map|zip) provides a lazy version of each function. Part of the patch was contributed by Michael Salib.
Diffstat (limited to 'test_six.py')
-rw-r--r--test_six.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/test_six.py b/test_six.py
index 70f5f25..38da028 100644
--- a/test_six.py
+++ b/test_six.py
@@ -91,6 +91,22 @@ def test_move_items(item_name):
raise
+def test_filter():
+ from six.moves import filter
+ f = filter(lambda x: x % 2, range(10))
+ assert six.advance_iterator(f) == 1
+
+
+def test_map():
+ from six.moves import map
+ assert six.advance_iterator(map(lambda x: x + 1, range(2))) == 1
+
+
+def test_zip():
+ from six.moves import zip
+ assert six.advance_iterator(zip(range(2), range(2))) == (0, 0)
+
+
class TestCustomizedMoves:
def teardown_method(self, meth):