#NEWLINE# def test_OrValidator_failure_with_exception( ) : #NEWLINE# #INDENT# toss_error = mock . MagicMock ( side_effect = UploadError ( 'something bad happened' ) ) #NEWLINE# or_validator = validators . OrValidator ( toss_error , toss_error , toss_error ) #NEWLINE# with pytest . raises ( UploadError ) as excinfo : #NEWLINE# #INDENT# or_validator ( DummyFile ( filename = 'wolololo.wav' ) , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# assert ( toss_error . call_count == 3 ) #NEWLINE# assert ( len ( excinfo . value . args [ 0 ] ) == 3 ) #NEWLINE# assert all ( ( ( 'something bad happened' == excinfo ) for e in excinfo . value . args [ 0 ] ) )