<s> from __future__ import absolute_import <EOL> from future . builtins . iterators import * <EOL> from future . tests . base import unittest <EOL> class TestIterators ( unittest . TestCase ) : <EOL> def test_range ( self ) : <EOL> self . assertNotEqual ( type ( range ( <NUM_LIT:10> ) ) , list ) <EOL> self . assertEqual ( sum ( range ( <NUM_LIT:10> ) ) , <NUM_LIT> ) <EOL> self . assertTrue ( <NUM_LIT:9> in range ( <NUM_LIT:10> ) ) <EOL> self . assertEqual ( list ( range ( <NUM_LIT:5> ) ) , [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] ) <EOL> self . assertEqual ( repr ( range ( <NUM_LIT:10> ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( range ( <NUM_LIT:1> , <NUM_LIT:10> ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( range ( <NUM_LIT:1> , <NUM_LIT:1> ) ) , '<STR_LIT>' ) <EOL> self . assertEqual ( repr ( range ( - <NUM_LIT:10> , <NUM_LIT:10> , <NUM_LIT:2> ) ) , '<STR_LIT>' ) <EOL> def test_map ( self ) : <EOL> def square ( x ) : <EOL> return x ** <NUM_LIT:2> <EOL> self . assertNotEqual ( type ( map ( square , range ( <NUM_LIT:10> ) ) ) , list ) <EOL> self . assertEqual ( sum ( map ( square , range ( <NUM_LIT:10> ) ) ) , <NUM_LIT> ) <EOL> self . assertEqual ( list ( map ( square , range ( <NUM_LIT:3> ) ) ) , [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:4> ] ) <EOL> def test_zip ( self ) : <EOL> a = range ( <NUM_LIT:10> ) <EOL> b = [ '<STR_LIT:a>' , '<STR_LIT:b>' , '<STR_LIT:c>' ] <EOL> self . assertNotEqual ( type ( zip ( a , b ) ) , list ) <EOL> self . assertEqual ( list ( zip ( a , b ) ) , [ ( <NUM_LIT:0> , '<STR_LIT:a>' ) , ( <NUM_LIT:1> , '<STR_LIT:b>' ) , ( <NUM_LIT:2> , '<STR_LIT:c>' ) ] ) <EOL> def test_filter ( self ) : <EOL> a = range ( <NUM_LIT:10> ) <EOL> def is_odd ( x ) : <EOL> return x % <NUM_LIT:2> == <NUM_LIT:1> <EOL> self . assertNotEqual ( type ( filter ( is_odd , a ) ) , list ) <EOL> self . assertEqual ( list ( filter ( is_odd , a ) ) , [ <NUM_LIT:1> , <NUM_LIT:3> , <NUM_LIT:5> , <NUM_LIT:7> , <NUM_LIT:9> ] ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> unittest . main ( ) </s>
