<s> "<STR_LIT>" <EOL> import unittest <EOL> from test import test_support <EOL> testmeths = [ <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> "<STR_LIT>" , <EOL> ] <EOL> callLst = [ ] <EOL> def trackCall ( f ) : <EOL> def track ( * args , ** kwargs ) : <EOL> callLst . append ( ( f . __name__ , args ) ) <EOL> return f ( * args , ** kwargs ) <EOL> return track <EOL> class AllTests : <EOL> trackCall = trackCall <EOL> @ trackCall <EOL> def __coerce__ ( self , * args ) : <EOL> return ( self , ) + args <EOL> @ trackCall <EOL> def __hash__ ( self , * args ) : <EOL> return hash ( id ( self ) ) <EOL> @ trackCall <EOL> def __str__ ( self , * args ) : <EOL> return "<STR_LIT>" <EOL> @ trackCall <EOL> def __repr__ ( self , * args ) : <EOL> return "<STR_LIT>" <EOL> @ trackCall <EOL> def __int__ ( self , * args ) : <EOL> return <NUM_LIT:1> <EOL> @ trackCall <EOL> def __float__ ( self , * args ) : <EOL> return <NUM_LIT:1.0> <EOL> @ trackCall <EOL> def __long__ ( self , * args ) : <EOL> return <NUM_LIT:1> L <EOL> @ trackCall <EOL> def __oct__ ( self , * args ) : <EOL> return '<STR_LIT>' <EOL> @ trackCall <EOL> def __hex__ ( self , * args ) : <EOL> return '<STR_LIT>' <EOL> @ trackCall <EOL> def __cmp__ ( self , * args ) : <EOL> return <NUM_LIT:0> <EOL> method_template = """<STR_LIT>""" <EOL> for method in testmeths : <EOL> exec method_template % locals ( ) in AllTests . __dict__ <EOL> del method , method_template <EOL> class ClassTests ( unittest . TestCase ) : <EOL> def setUp ( self ) : <EOL> callLst [ : ] = [ ] <EOL> def assertCallStack ( self , expected_calls ) : <EOL> actualCallList = callLst [ : ] <EOL> if expected_calls != actualCallList : <EOL> self . fail ( "<STR_LIT>" % <EOL> ( expected_calls , actualCallList ) ) <EOL> def testInit ( self ) : <EOL> foo = AllTests ( ) <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( foo , ) ) ] ) <EOL> def testBinaryOps ( self ) : <EOL> testme = AllTests ( ) <EOL> callLst [ : ] = [ ] <EOL> testme + <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> + testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme - <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> - testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme * <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> * testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> if <NUM_LIT:1> / <NUM_LIT:2> == <NUM_LIT:0> : <EOL> callLst [ : ] = [ ] <EOL> testme / <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> / testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme % <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> % testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> divmod ( testme , <NUM_LIT:1> ) <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> divmod ( <NUM_LIT:1> , testme ) <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme ** <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> ** testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme >> <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> >> testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme << <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> << testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme & <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> & testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme | <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> | testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme ^ <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> ^ testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> def testListAndDictOps ( self ) : <EOL> testme = AllTests ( ) <EOL> class Empty : pass <EOL> try : <EOL> <NUM_LIT:1> in Empty ( ) <EOL> self . fail ( '<STR_LIT>' ) <EOL> except TypeError : <EOL> pass <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> in testme <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ <NUM_LIT:1> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ <NUM_LIT:1> ] = <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:1> , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme [ <NUM_LIT:1> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:0> , <NUM_LIT> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> ] = "<STR_LIT>" <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:0> , <NUM_LIT> , "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme [ : <NUM_LIT> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <NUM_LIT:0> , <NUM_LIT> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ <NUM_LIT:2> : <NUM_LIT> : <NUM_LIT:10> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , slice ( <NUM_LIT:2> , <NUM_LIT> , <NUM_LIT:10> ) ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ <NUM_LIT:2> : <NUM_LIT> : <NUM_LIT:10> ] = "<STR_LIT>" <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , slice ( <NUM_LIT:2> , <NUM_LIT> , <NUM_LIT:10> ) , <EOL> "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme [ <NUM_LIT:2> : <NUM_LIT> : <NUM_LIT:10> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , slice ( <NUM_LIT:2> , <NUM_LIT> , <NUM_LIT:10> ) ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> , ... , : <NUM_LIT> : , <NUM_LIT> , <NUM_LIT:100> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ( slice ( None , <NUM_LIT> , None ) , <EOL> Ellipsis , <EOL> slice ( None , <NUM_LIT> , None ) , <EOL> <NUM_LIT> , <NUM_LIT:100> ) ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> , ... , : <NUM_LIT> : , <NUM_LIT> , <NUM_LIT:100> ] = "<STR_LIT>" <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ( slice ( None , <NUM_LIT> , None ) , <EOL> Ellipsis , <EOL> slice ( None , <NUM_LIT> , None ) , <EOL> <NUM_LIT> , <NUM_LIT:100> ) , "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme [ : <NUM_LIT> , ... , : <NUM_LIT> : , <NUM_LIT> , <NUM_LIT:100> ] <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ( slice ( None , <NUM_LIT> , None ) , <EOL> Ellipsis , <EOL> slice ( None , <NUM_LIT> , None ) , <EOL> <NUM_LIT> , <NUM_LIT:100> ) ) ) ] ) <EOL> getslice = AllTests . __getslice__ <EOL> del AllTests . __getslice__ <EOL> setslice = AllTests . __setslice__ <EOL> del AllTests . __setslice__ <EOL> delslice = AllTests . __delslice__ <EOL> del AllTests . __delslice__ <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> ] <EOL> if test_support . is_jython : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( None , <NUM_LIT> , None ) ) ) ] ) <EOL> else : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( <NUM_LIT:0> , <NUM_LIT> , None ) ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme [ : <NUM_LIT> ] = "<STR_LIT>" <EOL> if test_support . is_jython : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( None , <NUM_LIT> , None ) , <EOL> "<STR_LIT>" ) ) ] ) <EOL> else : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( <NUM_LIT:0> , <NUM_LIT> , None ) , <EOL> "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme [ : <NUM_LIT> ] <EOL> if test_support . is_jython : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( None , <NUM_LIT> , None ) ) ) ] ) <EOL> else : <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , <EOL> slice ( <NUM_LIT:0> , <NUM_LIT> , None ) ) ) ] ) <EOL> AllTests . __getslice__ = getslice <EOL> AllTests . __setslice__ = setslice <EOL> AllTests . __delslice__ = delslice <EOL> @ test_support . cpython_only <EOL> def testDelItem ( self ) : <EOL> class A : <EOL> ok = False <EOL> def __delitem__ ( self , key ) : <EOL> self . ok = True <EOL> a = A ( ) <EOL> from _testcapi import sequence_delitem <EOL> sequence_delitem ( a , <NUM_LIT:2> ) <EOL> self . assertTrue ( a . ok ) <EOL> def testUnaryOps ( self ) : <EOL> testme = AllTests ( ) <EOL> callLst [ : ] = [ ] <EOL> - testme <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> + testme <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> abs ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> int ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> long ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> float ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> oct ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> hex ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> def testMisc ( self ) : <EOL> testme = AllTests ( ) <EOL> callLst [ : ] = [ ] <EOL> hash ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> repr ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> str ( testme ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme == <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme < <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme > <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> eval ( '<STR_LIT>' ) <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme != <NUM_LIT:1> <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( testme , <NUM_LIT:1> ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> == testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( <NUM_LIT:1> , testme ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> < testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( <NUM_LIT:1> , testme ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> > testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( <NUM_LIT:1> , testme ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> eval ( '<STR_LIT>' ) <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( <NUM_LIT:1> , testme ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> <NUM_LIT:1> != testme <EOL> self . assertCallStack ( [ ( "<STR_LIT>" , ( testme , <NUM_LIT:1> ) ) , ( '<STR_LIT>' , ( <NUM_LIT:1> , testme ) ) ] ) <EOL> def testGetSetAndDel ( self ) : <EOL> class ExtraTests ( AllTests ) : <EOL> @ trackCall <EOL> def __getattr__ ( self , * args ) : <EOL> return "<STR_LIT>" <EOL> @ trackCall <EOL> def __setattr__ ( self , * args ) : <EOL> pass <EOL> @ trackCall <EOL> def __delattr__ ( self , * args ) : <EOL> pass <EOL> testme = ExtraTests ( ) <EOL> callLst [ : ] = [ ] <EOL> testme . spam <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> testme . eggs = "<STR_LIT>" <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , "<STR_LIT>" , <EOL> "<STR_LIT>" ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> del testme . cardinal <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( testme , "<STR_LIT>" ) ) ] ) <EOL> def testDel ( self ) : <EOL> if not test_support . is_jython : <EOL> x = [ ] <EOL> class DelTest : <EOL> def __del__ ( self ) : <EOL> x . append ( "<STR_LIT>" ) <EOL> testme = DelTest ( ) <EOL> del testme <EOL> import gc <EOL> gc . collect ( ) <EOL> self . assertEqual ( [ "<STR_LIT>" ] , x ) <EOL> def testBadTypeReturned ( self ) : <EOL> class BadTypeClass : <EOL> def __int__ ( self ) : <EOL> return None <EOL> __float__ = __int__ <EOL> __long__ = __int__ <EOL> __str__ = __int__ <EOL> __repr__ = __int__ <EOL> __oct__ = __int__ <EOL> __hex__ = __int__ <EOL> for f in [ int , float , long , str , repr , oct , hex ] : <EOL> self . assertRaises ( TypeError , f , BadTypeClass ( ) ) <EOL> def testMixIntsAndLongs ( self ) : <EOL> class IntLongMixClass : <EOL> @ trackCall <EOL> def __int__ ( self ) : <EOL> return <NUM_LIT> L <EOL> @ trackCall <EOL> def __long__ ( self ) : <EOL> return <NUM_LIT:64> <EOL> mixIntAndLong = IntLongMixClass ( ) <EOL> callLst [ : ] = [ ] <EOL> as_int = int ( mixIntAndLong ) <EOL> self . assertEqual ( type ( as_int ) , long ) <EOL> self . assertEqual ( as_int , <NUM_LIT> L ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( mixIntAndLong , ) ) ] ) <EOL> callLst [ : ] = [ ] <EOL> as_long = long ( mixIntAndLong ) <EOL> if test_support . is_jython : <EOL> self . assertEqual ( type ( as_long ) , int ) <EOL> else : <EOL> self . assertEqual ( type ( as_long ) , long ) <EOL> self . assertEqual ( as_long , <NUM_LIT:64> ) <EOL> self . assertCallStack ( [ ( '<STR_LIT>' , ( mixIntAndLong , ) ) ] ) <EOL> def testHashStuff ( self ) : <EOL> class C0 : <EOL> pass <EOL> hash ( C0 ( ) ) <EOL> class C1 : <EOL> def __cmp__ ( self , other ) : return <NUM_LIT:0> <EOL> self . assertRaises ( TypeError , hash , C1 ( ) ) <EOL> class C2 : <EOL> def __eq__ ( self , other ) : return <NUM_LIT:1> <EOL> self . assertRaises ( TypeError , hash , C2 ( ) ) <EOL> def testSFBug532646 ( self ) : <EOL> class A : <EOL> pass <EOL> A . __call__ = A ( ) <EOL> a = A ( ) <EOL> try : <EOL> a ( ) <EOL> except RuntimeError : <EOL> pass <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def testForExceptionsRaisedInInstanceGetattr2 ( self ) : <EOL> def booh ( self ) : <EOL> raise AttributeError ( "<STR_LIT>" ) <EOL> class A : <EOL> a = property ( booh ) <EOL> try : <EOL> A ( ) . a <EOL> except AttributeError , x : <EOL> if str ( x ) != "<STR_LIT>" : <EOL> self . fail ( "<STR_LIT>" % x ) <EOL> class E : <EOL> __eq__ = property ( booh ) <EOL> E ( ) == E ( ) <EOL> class I : <EOL> __init__ = property ( booh ) <EOL> try : <EOL> I ( ) <EOL> except AttributeError , x : <EOL> pass <EOL> else : <EOL> self . fail ( "<STR_LIT>" ) <EOL> def testHashComparisonOfMethods ( self ) : <EOL> class A : <EOL> def __init__ ( self , x ) : <EOL> self . x = x <EOL> def f ( self ) : <EOL> pass <EOL> def g ( self ) : <EOL> pass <EOL> def __eq__ ( self , other ) : <EOL> return self . x == other . x <EOL> def __hash__ ( self ) : <EOL> return self . x <EOL> class B ( A ) : <EOL> pass <EOL> a1 = A ( <NUM_LIT:1> ) <EOL> a2 = A ( <NUM_LIT:2> ) <EOL> self . assertEqual ( a1 . f , a1 . f ) <EOL> self . assertNotEqual ( a1 . f , a2 . f ) <EOL> self . assertNotEqual ( a1 . f , a1 . g ) <EOL> self . assertEqual ( a1 . f , A ( <NUM_LIT:1> ) . f ) <EOL> self . assertEqual ( hash ( a1 . f ) , hash ( a1 . f ) ) <EOL> self . assertEqual ( hash ( a1 . f ) , hash ( A ( <NUM_LIT:1> ) . f ) ) <EOL> self . assertNotEqual ( A . f , a1 . f ) <EOL> self . assertNotEqual ( A . f , A . g ) <EOL> self . assertEqual ( B . f , A . f ) <EOL> self . assertEqual ( hash ( B . f ) , hash ( A . f ) ) <EOL> a = A ( hash ( A . f . im_func ) ^ ( - <NUM_LIT:1> ) ) <EOL> hash ( a . f ) <EOL> def testAttrSlots ( self ) : <EOL> class C : <EOL> pass <EOL> for c in C , C ( ) : <EOL> self . assertRaises ( TypeError , type ( c ) . __getattribute__ , c , [ ] ) <EOL> self . assertRaises ( TypeError , type ( c ) . __setattr__ , c , [ ] , [ ] ) <EOL> def test_main ( ) : <EOL> with test_support . check_py3k_warnings ( <EOL> ( "<STR_LIT>" , DeprecationWarning ) , <EOL> ( "<STR_LIT>" , DeprecationWarning ) , <EOL> ( "<STR_LIT>" , DeprecationWarning ) ) : <EOL> test_support . run_unittest ( ClassTests ) <EOL> if __name__ == '<STR_LIT:__main__>' : <EOL> test_main ( ) </s>
