#NEWLINE# def testCleanUp( self ) : #NEWLINE# #INDENT# class TestableTest ( unittest . TestCase ) : #NEWLINE# #INDENT# def testNothing( self ) : #NEWLINE# #INDENT# pass #NEWLINE# #UNINDENT# #UNINDENT# test = TestableTest ( 'testNothing' ) #NEWLINE# self . assertEqual ( test . _cleanups , [ ] ) #NEWLINE# cleanups = [ ] #NEWLINE# def cleanup1( * args , **kwargs ) : #NEWLINE# #INDENT# cleanups . append ( ( 1 , args , kwargs ) ) #NEWLINE# #UNINDENT# def cleanup2( * args , **kwargs ) : #NEWLINE# #INDENT# cleanups . append ( ( 2 , args , kwargs ) ) #NEWLINE# #UNINDENT# test . addCleanup ( cleanup1 , 1 , 2 , 3 , four = 'hello' , five = 'goodbye' ) #NEWLINE# test . addCleanup ( cleanup2 ) #NEWLINE# self . assertEqual ( test . _cleanups , [ ( self , ( 1 , 2 , 3 ) , dict ( four = 'hello' , five = 'goodbye' ) ) , ( cleanup2 , ( ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ] ) #NEWLINE# result = test . doCleanups ( ) #NEWLINE# self . assertTrue ( result ) #NEWLINE# self . assertEqual ( cleanups , [ ( 2 , ( ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) , ( 1 , ( 1 , 2 , 3 ) , dict ( four = 'hello' , five = 'goodbye' ) ) ] )