diff options
author | Raymond Hettinger <python@rcn.com> | 2008-02-25 22:42:32 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2008-02-25 22:42:32 (GMT) |
commit | 9d63837e9b9f4163e4019257f5c15b8007c8ad2e (patch) | |
tree | 16cdbd6b0fbdaf5bfed98dfff57b6f8540474eb3 /Lib | |
parent | df4198915a5329ba300e29d187febdf8bae65b74 (diff) | |
download | cpython-9d63837e9b9f4163e4019257f5c15b8007c8ad2e.zip cpython-9d63837e9b9f4163e4019257f5c15b8007c8ad2e.tar.gz cpython-9d63837e9b9f4163e4019257f5c15b8007c8ad2e.tar.bz2 |
Make sure the itertools filter functions give the same performance for func=bool as func=None.
Diffstat (limited to 'Lib')
-rw-r--r-- | Lib/test/test_itertools.py | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/Lib/test/test_itertools.py b/Lib/test/test_itertools.py index f5dd069..dc9081e 100644 --- a/Lib/test/test_itertools.py +++ b/Lib/test/test_itertools.py @@ -171,6 +171,7 @@ class TestBasicOps(unittest.TestCase): def test_ifilter(self): self.assertEqual(list(ifilter(isEven, range(6))), [0,2,4]) self.assertEqual(list(ifilter(None, [0,1,0,2,0])), [1,2]) + self.assertEqual(list(ifilter(bool, [0,1,0,2,0])), [1,2]) self.assertEqual(take(4, ifilter(isEven, count())), [0,2,4,6]) self.assertRaises(TypeError, ifilter) self.assertRaises(TypeError, ifilter, lambda x:x) @@ -181,6 +182,7 @@ class TestBasicOps(unittest.TestCase): def test_ifilterfalse(self): self.assertEqual(list(ifilterfalse(isEven, range(6))), [1,3,5]) self.assertEqual(list(ifilterfalse(None, [0,1,0,2,0])), [0,0,0]) + self.assertEqual(list(ifilterfalse(bool, [0,1,0,2,0])), [0,0,0]) self.assertEqual(take(4, ifilterfalse(isEven, count())), [1,3,5,7]) self.assertRaises(TypeError, ifilterfalse) self.assertRaises(TypeError, ifilterfalse, lambda x:x) |