#NEWLINE# def test_commit_removes_pending( self ) : #NEWLINE# #INDENT# ( Post , Blog , lazy_posts ) = self . _fixture ( ) #NEWLINE# p1 = Post ( 'post 1' ) #NEWLINE# lazy_posts . return_value = attributes . PASSIVE_NO_RESULT #NEWLINE# b = Blog ( 'blog 1' ) #NEWLINE# p1 . blog = b #NEWLINE# b_state = attributes . instance_state ( b ) #NEWLINE# p1_state = attributes . instance_state ( p1 ) #NEWLINE# b_state . _commit_all ( attributes . instance_dict ( Post ) ) #NEWLINE# p1_state . _commit_all ( attributes . instance_dict ( p1 ) ) #NEWLINE# lazy_posts . return_value = [ p1 ] #NEWLINE# eq_ ( b . posts , [ Post ( 'post 1' ) ] ) #NEWLINE# eq_ ( lazy_posts . mock_calls , [ call ( b_state , attributes . PASSIVE_NO_FETCH ) , call ( b_state , attributes . PASSIVE_OFF ) ] )