#NEWLINE# def test_state_on_add_remove( self ) : #NEWLINE# #INDENT# ( Post , Blog , lazy_posts ) = self . _fixture ( ) #NEWLINE# lazy_posts . return_value = attributes . PASSIVE_NO_RESULT #NEWLINE# b = Blog ( 'blog 1' ) #NEWLINE# b1_state = attributes . instance_state ( b ) #NEWLINE# p = Post ( 'post 1' ) #NEWLINE# p . blog = b #NEWLINE# eq_ ( lazy_posts . mock_calls , [ call ( b1_state , attributes . PASSIVE_NO_FETCH ) ] ) #NEWLINE# p . blog = None #NEWLINE# eq_ ( lazy_posts . mock_calls , [ call ( b1_state , attributes . PASSIVE_NO_FETCH ) , call ( b1_state , attributes . PASSIVE_NO_FETCH ) ] ) #NEWLINE# lazy_posts . return_value = [ ] #NEWLINE# eq_ ( b . posts , [ ] ) #NEWLINE# eq_ ( lazy_posts . mock_calls , [ call ( b1_state , attributes . PASSIVE_NO_FETCH ) , call ( b1_state , attributes . PASSIVE_NO_FETCH ) , call ( b1_state , attributes . PASSIVE_OFF ) ] )