fix: Template on empty/unreadable file exception is a string, not a float

pull/91/head
rickmeasham 2021-10-30 22:59:26 +11:00
rodzic d3656afcae
commit e455fe8d76
3 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -82,7 +82,7 @@ class ICalDownload:
content = f.read()
if not content:
raise IOError("File %f is not readable or is empty!" % file)
raise IOError("File %s is not readable or is empty!" % file)
return self.decode(content, apple_fix=apple_fix)

Wyświetl plik

Wyświetl plik

@ -93,3 +93,14 @@ DTSTART:19180331T020000
# Delete tmp dir
os.chdir("..")
shutil.rmtree("tmp")
def test_empty_file(self):
empty_ical = "test/test_data/empty.ics"
with self.assertRaises(IOError) as cm:
icalevents.icaldownload.ICalDownload().data_from_file(empty_ical)
self.assertEqual(
str(cm.exception),
"File test/test_data/empty.ics is not readable or is empty!"
)