Skip to content

Commit

Permalink
fix: replace usage of IOError with OSError
Browse files Browse the repository at this point in the history
`IOError` was merged in `OSError` since Python 3.3 (https://docs.python.org/3/library/exceptions.html#OSError).
  • Loading branch information
BoboTiG committed Feb 4, 2025
1 parent 301bde0 commit deda7ba
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions icalevents/icaldownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,13 +80,13 @@ def data_from_file(self, file, apple_fix=False):
content = f.read()

if not content:
raise IOError("File %s is not readable or is empty!" % file)
raise OSError("File %s is not readable or is empty!" % file)

return self.decode(content, apple_fix=apple_fix)

def data_from_string(self, string_content, apple_fix=False):
if not string_content:
raise IOError("String content is not readable or is empty!")
raise OSError("String content is not readable or is empty!")

Check warning on line 89 in icalevents/icaldownload.py

View check run for this annotation

Codecov / codecov/patch

icalevents/icaldownload.py#L89

Added line #L89 was not covered by tests

return self.decode(string_content, apple_fix=apple_fix)

Expand Down
2 changes: 1 addition & 1 deletion test/test_icaldownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def test_data_from_file_apple(self):
def test_empty_file(self):
empty_ical = "test/test_data/empty.ics"

with self.assertRaises(IOError) as cm:
with self.assertRaises(OSError) as cm:
icalevents.icaldownload.ICalDownload().data_from_file(empty_ical)

self.assertEqual(
Expand Down

0 comments on commit deda7ba

Please sign in to comment.