#NEWLINE# def test_pre_rewrite_then_post_rewrite( self ) : #NEWLINE# #INDENT# RewriteRuleManager . rulesets [ PRE ] = [ self . sample_rewrite_rule ] #NEWLINE# RewriteRuleManager . rulesets [ POST ] = [ self . sample_rewrite_rule ] #NEWLINE# apply_mock = Mock ( side_effect = [ 'carbon.foo.rewrite' , 'carbon.foo.rewrite.rewrite' ] ) #NEWLINE# with patch . object ( self . sample_rewrite_rule , 'apply' , self ) : #NEWLINE# #INDENT# list ( self . processor . process ( 'carbon.foo' , ( 0 , 0 ) ) ) #NEWLINE# #UNINDENT# self . assertEqual ( [ call ( 'carbon.foo' ) , call ( 'carbon.foo.rewrite' ) ] , apply_mock . call_args_list )