Skip to content

Commit

Permalink
Patched errors
Browse files Browse the repository at this point in the history
  • Loading branch information
Olthoff231381 committed Aug 1, 2024
1 parent be491f1 commit 7008e16
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 3 deletions.
2 changes: 1 addition & 1 deletion mailcom/inout.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ def list_of_files(directory_name: str) -> list[Path]:
pattern = [".eml", ".html"] # we would not change the file type through user input
email_list = [mp.resolve() for mp in mypath.glob("**/*") if mp.suffix in pattern]
if len(email_list) == 0:
raise ValueError("The directory {} does not contain .eml or .html files")
raise ValueError("The directory {} does not contain .eml or .html files".format(mypath))
return email_list


Expand Down
2 changes: 1 addition & 1 deletion mailcom/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ def init_transformers():

def check_dir(path: str) -> bool:
if not os.path.exists(path):
raise OSError("Path {} does not exist")
raise OSError("Path {} does not exist".format(path))
else:
return True

Expand Down
3 changes: 2 additions & 1 deletion mailcom/test/test_parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
def test_check_dir(tmpdir):
mydir = tmpdir.mkdir("sub")
assert check_dir(str(mydir))
assert not check_dir(str(tmpdir.join("sub2")))
with pytest.raises(OSError):
assert not check_dir(str(tmpdir.join("sub2")))


def test_make_dir(tmpdir):
Expand Down

0 comments on commit 7008e16

Please sign in to comment.