#NEWLINE# def test_AndValidator_failure_with_callable( ) : #NEWLINE# #INDENT# dummy_file = DummyFile ( filename = 'doesntmatter.exe' ) #NEWLINE# truthy = mock . MagicMock ( return_value = True ) #NEWLINE# falsey = mock . MagicMock ( return_value = False ) #NEWLINE# and_validator = validators . AndValidator ( falsey , truthy ) #NEWLINE# with pytest . raises ( UploadError ) as excinfo : #NEWLINE# #INDENT# and_validator ( dummy_file , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) #NEWLINE# #UNINDENT# assert ( 'returned false in' in str ( excinfo . value ) ) #NEWLINE# assert ( dummy_file . call_count == 1 ) #NEWLINE# assert ( falsey . call_args == mock . call ( dummy_file , { #NEWLINE# #INDENT# #NEWLINE# #UNINDENT# } ) ) #NEWLINE# assert ( truthy . call_count == 0 )