<s> from UserList import UserList <EOL> from test import test_support , list_tests <EOL> class UserListTest ( list_tests . CommonTest ) : <EOL> type2test = UserList <EOL> def test_getslice ( self ) : <EOL> super ( UserListTest , self ) . test_getslice ( ) <EOL> l = [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> , <NUM_LIT:3> , <NUM_LIT:4> ] <EOL> u = self . type2test ( l ) <EOL> for i in range ( - <NUM_LIT:3> , <NUM_LIT:6> ) : <EOL> self . assertEqual ( u [ : i ] , l [ : i ] ) <EOL> self . assertEqual ( u [ i : ] , l [ i : ] ) <EOL> for j in xrange ( - <NUM_LIT:3> , <NUM_LIT:6> ) : <EOL> self . assertEqual ( u [ i : j ] , l [ i : j ] ) <EOL> def test_add_specials ( self ) : <EOL> u = UserList ( "<STR_LIT>" ) <EOL> u2 = u + "<STR_LIT>" <EOL> self . assertEqual ( u2 , list ( "<STR_LIT>" ) ) <EOL> def test_radd_specials ( self ) : <EOL> u = UserList ( "<STR_LIT>" ) <EOL> u2 = "<STR_LIT>" + u <EOL> self . assertEqual ( u2 , list ( "<STR_LIT>" ) ) <EOL> u2 = u . __radd__ ( UserList ( "<STR_LIT>" ) ) <EOL> self . assertEqual ( u2 , list ( "<STR_LIT>" ) ) <EOL> def test_iadd ( self ) : <EOL> super ( UserListTest , self ) . test_iadd ( ) <EOL> u = [ <NUM_LIT:0> , <NUM_LIT:1> ] <EOL> u += UserList ( [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> self . assertEqual ( u , [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> def test_mixedcmp ( self ) : <EOL> u = self . type2test ( [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> self . assertEqual ( u , [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> self . assertNotEqual ( u , [ <NUM_LIT:0> ] ) <EOL> self . assertNotEqual ( u , [ <NUM_LIT:0> , <NUM_LIT:2> ] ) <EOL> def test_mixedadd ( self ) : <EOL> u = self . type2test ( [ <NUM_LIT:0> , <NUM_LIT:1> ] ) <EOL> self . assertEqual ( u + [ ] , u ) <EOL> self . assertEqual ( u + [ <NUM_LIT:2> ] , [ <NUM_LIT:0> , <NUM_LIT:1> , <NUM_LIT:2> ] ) <EOL> def test_getitemoverwriteiter ( self ) : <EOL> class T ( self . type2test ) : <EOL> def __getitem__ ( self , key ) : <EOL> return str ( key ) + '<STR_LIT>' <EOL> self . assertEqual ( iter ( T ( ( <NUM_LIT:1> , <NUM_LIT:2> ) ) ) . next ( ) , "<STR_LIT>" ) <EOL> def test_main ( ) : <EOL> with test_support . check_py3k_warnings ( <EOL> ( "<STR_LIT>" , DeprecationWarning ) ) : <EOL> test_support . run_unittest ( UserListTest ) <EOL> if __name__ == "<STR_LIT:__main__>" : <EOL> test_main ( ) </s>
