@@ -324,16 +324,16 @@ def test_ifilter(self):
324324 self .assertRaises (TypeError , ifilter , isEven , 3 )
325325 self .assertRaises (TypeError , next , ifilter (range (6 ), range (6 )))
326326
327- def test_ifilterfalse (self ):
328- self .assertEqual (list (ifilterfalse (isEven , range (6 ))), [1 ,3 ,5 ])
329- self .assertEqual (list (ifilterfalse (None , [0 ,1 ,0 ,2 ,0 ])), [0 ,0 ,0 ])
330- self .assertEqual (list (ifilterfalse (bool , [0 ,1 ,0 ,2 ,0 ])), [0 ,0 ,0 ])
331- self .assertEqual (take (4 , ifilterfalse (isEven , count ())), [1 ,3 ,5 ,7 ])
332- self .assertRaises (TypeError , ifilterfalse )
333- self .assertRaises (TypeError , ifilterfalse , lambda x :x )
334- self .assertRaises (TypeError , ifilterfalse , lambda x :x , range (6 ), 7 )
335- self .assertRaises (TypeError , ifilterfalse , isEven , 3 )
336- self .assertRaises (TypeError , next , ifilterfalse (range (6 ), range (6 )))
327+ def test_filterfalse (self ):
328+ self .assertEqual (list (filterfalse (isEven , range (6 ))), [1 ,3 ,5 ])
329+ self .assertEqual (list (filterfalse (None , [0 ,1 ,0 ,2 ,0 ])), [0 ,0 ,0 ])
330+ self .assertEqual (list (filterfalse (bool , [0 ,1 ,0 ,2 ,0 ])), [0 ,0 ,0 ])
331+ self .assertEqual (take (4 , filterfalse (isEven , count ())), [1 ,3 ,5 ,7 ])
332+ self .assertRaises (TypeError , filterfalse )
333+ self .assertRaises (TypeError , filterfalse , lambda x :x )
334+ self .assertRaises (TypeError , filterfalse , lambda x :x , range (6 ), 7 )
335+ self .assertRaises (TypeError , filterfalse , isEven , 3 )
336+ self .assertRaises (TypeError , next , filterfalse (range (6 ), range (6 )))
337337
338338 def test_izip (self ):
339339 # XXX This is rather silly now that builtin zip() calls izip()...
@@ -366,25 +366,25 @@ def test_iziplongest(self):
366366 ]:
367367 target = [tuple ([arg [i ] if i < len (arg ) else None for arg in args ])
368368 for i in range (max (map (len , args )))]
369- self .assertEqual (list (izip_longest (* args )), target )
370- self .assertEqual (list (izip_longest (* args , ** {})), target )
369+ self .assertEqual (list (zip_longest (* args )), target )
370+ self .assertEqual (list (zip_longest (* args , ** {})), target )
371371 target = [tuple ((e is None and 'X' or e ) for e in t ) for t in target ] # Replace None fills with 'X'
372- self .assertEqual (list (izip_longest (* args , ** dict (fillvalue = 'X' ))), target )
372+ self .assertEqual (list (zip_longest (* args , ** dict (fillvalue = 'X' ))), target )
373373
374- self .assertEqual (take (3 ,izip_longest ('abcdef' , count ())), list (zip ('abcdef' , range (3 )))) # take 3 from infinite input
374+ self .assertEqual (take (3 ,zip_longest ('abcdef' , count ())), list (zip ('abcdef' , range (3 )))) # take 3 from infinite input
375375
376- self .assertEqual (list (izip_longest ()), list (zip ()))
377- self .assertEqual (list (izip_longest ([])), list (zip ([])))
378- self .assertEqual (list (izip_longest ('abcdef' )), list (zip ('abcdef' )))
376+ self .assertEqual (list (zip_longest ()), list (zip ()))
377+ self .assertEqual (list (zip_longest ([])), list (zip ([])))
378+ self .assertEqual (list (zip_longest ('abcdef' )), list (zip ('abcdef' )))
379379
380- self .assertEqual (list (izip_longest ('abc' , 'defg' , ** {})),
380+ self .assertEqual (list (zip_longest ('abc' , 'defg' , ** {})),
381381 list (izip (list ('abc' )+ [None ], 'defg' ))) # empty keyword dict
382- self .assertRaises (TypeError , izip_longest , 3 )
383- self .assertRaises (TypeError , izip_longest , range (3 ), 3 )
382+ self .assertRaises (TypeError , zip_longest , 3 )
383+ self .assertRaises (TypeError , zip_longest , range (3 ), 3 )
384384
385385 for stmt in [
386- "izip_longest ('abc', fv=1)" ,
387- "izip_longest ('abc', fillvalue=1, bogus_keyword=None)" ,
386+ "zip_longest ('abc', fv=1)" ,
387+ "zip_longest ('abc', fillvalue=1, bogus_keyword=None)" ,
388388 ]:
389389 try :
390390 eval (stmt , globals (), locals ())
@@ -394,13 +394,13 @@ def test_iziplongest(self):
394394 self .fail ('Did not raise Type in: ' + stmt )
395395
396396 # Check tuple re-use (implementation detail)
397- self .assertEqual ([tuple (list (pair )) for pair in izip_longest ('abc' , 'def' )],
397+ self .assertEqual ([tuple (list (pair )) for pair in zip_longest ('abc' , 'def' )],
398398 list (zip ('abc' , 'def' )))
399- self .assertEqual ([pair for pair in izip_longest ('abc' , 'def' )],
399+ self .assertEqual ([pair for pair in zip_longest ('abc' , 'def' )],
400400 list (zip ('abc' , 'def' )))
401- ids = list (map (id , izip_longest ('abc' , 'def' )))
401+ ids = list (map (id , zip_longest ('abc' , 'def' )))
402402 self .assertEqual (min (ids ), max (ids ))
403- ids = list (map (id , list (izip_longest ('abc' , 'def' ))))
403+ ids = list (map (id , list (zip_longest ('abc' , 'def' ))))
404404 self .assertEqual (len (dict .fromkeys (ids )), len (ids ))
405405
406406 def test_product (self ):
@@ -659,7 +659,7 @@ def test_StopIteration(self):
659659
660660 self .assertRaises (StopIteration , next , repeat (None , 0 ))
661661
662- for f in (ifilter , ifilterfalse , imap , takewhile , dropwhile , starmap ):
662+ for f in (ifilter , filterfalse , imap , takewhile , dropwhile , starmap ):
663663 self .assertRaises (StopIteration , next , f (lambda x :x , []))
664664 self .assertRaises (StopIteration , next , f (lambda x :x , StopNow ()))
665665
@@ -690,9 +690,9 @@ def test_ifilter(self):
690690 a = []
691691 self .makecycle (ifilter (lambda x :True , [a ]* 2 ), a )
692692
693- def test_ifilterfalse (self ):
693+ def test_filterfalse (self ):
694694 a = []
695- self .makecycle (ifilterfalse (lambda x :False , a ), a )
695+ self .makecycle (filterfalse (lambda x :False , a ), a )
696696
697697 def test_izip (self ):
698698 a = []
@@ -840,14 +840,14 @@ def test_ifilter(self):
840840 self .assertRaises (TypeError , ifilter , isEven , N (s ))
841841 self .assertRaises (ZeroDivisionError , list , ifilter (isEven , E (s )))
842842
843- def test_ifilterfalse (self ):
843+ def test_filterfalse (self ):
844844 for s in (range (10 ), range (0 ), range (1000 ), (7 ,11 ), range (2000 ,2200 ,5 )):
845845 for g in (G , I , Ig , S , L , R ):
846- self .assertEqual (list (ifilterfalse (isEven , g (s ))),
846+ self .assertEqual (list (filterfalse (isEven , g (s ))),
847847 [x for x in g (s ) if isOdd (x )])
848- self .assertRaises (TypeError , ifilterfalse , isEven , X (s ))
849- self .assertRaises (TypeError , ifilterfalse , isEven , N (s ))
850- self .assertRaises (ZeroDivisionError , list , ifilterfalse (isEven , E (s )))
848+ self .assertRaises (TypeError , filterfalse , isEven , X (s ))
849+ self .assertRaises (TypeError , filterfalse , isEven , N (s ))
850+ self .assertRaises (ZeroDivisionError , list , filterfalse (isEven , E (s )))
851851
852852 def test_izip (self ):
853853 for s in ("123" , "" , range (1000 ), ('do' , 1.2 ), range (2000 ,2200 ,5 )):
@@ -861,11 +861,11 @@ def test_izip(self):
861861 def test_iziplongest (self ):
862862 for s in ("123" , "" , range (1000 ), ('do' , 1.2 ), range (2000 ,2200 ,5 )):
863863 for g in (G , I , Ig , S , L , R ):
864- self .assertEqual (list (izip_longest (g (s ))), list (zip (g (s ))))
865- self .assertEqual (list (izip_longest (g (s ), g (s ))), list (zip (g (s ), g (s ))))
866- self .assertRaises (TypeError , izip_longest , X (s ))
867- self .assertRaises (TypeError , izip_longest , N (s ))
868- self .assertRaises (ZeroDivisionError , list , izip_longest (E (s )))
864+ self .assertEqual (list (zip_longest (g (s ))), list (zip (g (s ))))
865+ self .assertEqual (list (zip_longest (g (s ), g (s ))), list (zip (g (s ), g (s ))))
866+ self .assertRaises (TypeError , zip_longest , X (s ))
867+ self .assertRaises (TypeError , zip_longest , N (s ))
868+ self .assertRaises (ZeroDivisionError , list , zip_longest (E (s )))
869869
870870 def test_imap (self ):
871871 for s in (range (10 ), range (0 ), range (100 ), (7 ,11 ), range (20 ,50 ,5 )):
@@ -1001,7 +1001,7 @@ def gen2(x):
10011001class SubclassWithKwargsTest (unittest .TestCase ):
10021002 def test_keywords_in_subclass (self ):
10031003 # count is not subclassable...
1004- for cls in (repeat , izip , ifilter , ifilterfalse , chain , imap ,
1004+ for cls in (repeat , izip , ifilter , filterfalse , chain , imap ,
10051005 starmap , islice , takewhile , dropwhile , cycle ):
10061006 class Subclass (cls ):
10071007 def __init__ (self , newarg = None , * args ):
@@ -1085,7 +1085,7 @@ def __init__(self, newarg=None, *args):
10851085
10861086>>> def all(seq, pred=None):
10871087... "Returns True if pred(x) is true for every element in the iterable"
1088- ... for elem in ifilterfalse (pred, seq):
1088+ ... for elem in filterfalse (pred, seq):
10891089... return False
10901090... return True
10911091
0 commit comments