#NEWLINE# def test_AndValidator_failure_with_exception( ) : #NEWLINE# #INDENT# toss_error = mock . MagicMock ( side_effect = UploadError ( 'something bad happened' ) ) #NEWLINE# dummy_file = DummyFile ( filename = 'kindamatters.exe' ) #NEWLINE# and_validator = validators . AndValidator ( toss_error , excinfo ) #NEWLINE# with pytest . raises ( UploadError ) as excinfo : #NEWLINE# #INDENT# and_validator ( dummy_file , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# assert ( 'something bad happened' == str ( excinfo . value ) )