🐛 💄 better error handling. fix #70
This commit is contained in:
parent
c21d36f4d1
commit
e65e939c1b
|
@ -190,7 +190,12 @@ def load_data(
|
|||
reader = READERS.get_a_plugin(file_type, library)
|
||||
except NoSupportingPluginFound:
|
||||
if file_name:
|
||||
if not os.path.exists(file_name):
|
||||
if os.path.exists(file_name):
|
||||
if os.path.isfile(file_name):
|
||||
raise
|
||||
else:
|
||||
raise IOError("%s is not a file" % file_name)
|
||||
else:
|
||||
raise IOError("%s does not exist" % file_name)
|
||||
else:
|
||||
raise
|
||||
|
|
|
@ -15,6 +15,11 @@ from zipfile import BadZipfile
|
|||
PY2 = sys.version_info[0] == 2
|
||||
|
||||
|
||||
@raises(IOError)
|
||||
def test_directory_name_as_file():
|
||||
get_data('/')
|
||||
|
||||
|
||||
def test_force_file_type():
|
||||
test_file = "force_file_type.txt"
|
||||
data = get_data(
|
||||
|
|
Loading…
Reference in New Issue