Skip to content

Commit

Permalink
more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Olthoff231381 committed Sep 4, 2024
1 parent a26a83f commit 1f2f113
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
1 change: 0 additions & 1 deletion mailcom/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@ def make_dir(path: str):
# html_files = list_of_files(path_input, "html")
for file in eml_files:
text = get_text(file)
# if detect_html(text):
text = get_html_text(text)
print(text)

Check warning on line 124 in mailcom/parse.py

View check run for this annotation

Codecov / codecov/patch

mailcom/parse.py#L123-L124

Added lines #L123 - L124 were not covered by tests
# skip this text if email could not be parsed
Expand Down
12 changes: 11 additions & 1 deletion mailcom/test/test_inout.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from mailcom.inout import list_of_files, get_text, get_html_text
import pytest
from pathlib import Path

def test_list_of_files_found(tmp_path):
p = tmp_path / "test.eml"
Expand Down Expand Up @@ -34,4 +35,13 @@ def test_get_text_err():

def test_get_html_text():
html = """<html><head><title>Test</title></head></html>"""
assert get_html_text(html) == 'Test'
assert get_html_text(html) == 'Test'

def test_get_html_text_noHtml():
noHtml = """Test"""
assert get_html_text(noHtml) == 'Test'

def test_get_text_no_file(tmp_path):
p = tmp_path / "test.eml"
with pytest.raises(OSError):
get_text(p)

0 comments on commit 1f2f113

Please sign in to comment.