def test_isfile():
 schema = vol.Schema(cv.isfile)
 fake_file = 'this-file-does-not.exist'
 assert (not os.path.isfile(fake_file))
 for value in ('invalid', None, (-1), 0, 80000, fake_file):
  with pytest.raises(vol.Invalid):
   schema(value)
 with patch('os.path.isfile', Mock(return_value=True)):
  with patch('os.access', Mock(return_value=True)):
   schema('test.txt')

def test_isfile ( ) : schema = vol . Schema ( cv . isfile ) fake_file = 'this-file-does-not.exist' assert ( not os . path . isfile ( fake_file ) ) for value in ( 'invalid' , None , ( - 1 ) , 0 , 80000 , fake_file ) : with pytest . raises ( vol . Invalid ) : schema ( value ) with patch ( 'os.path.isfile' , Mock ( return_value = True ) ) : with patch ( 'os.access' , Mock ( return_value = True ) ) : schema ( 'test.txt' )
validate that the value is an existing file .