Skip to content
This repository has been archived by the owner on Jul 22, 2023. It is now read-only.

Commit

Permalink
style
Browse files Browse the repository at this point in the history
  • Loading branch information
sdpython committed Feb 4, 2023
1 parent ab517b8 commit c7492df
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 16 deletions.
4 changes: 2 additions & 2 deletions _unittests/ut_grabber/test_box_mock.py
Expand Up @@ -40,13 +40,13 @@ def test_box_mock(self):
html, _, __ = render.render(
"__LOC__", mail0, file_css="example_css.css", attachments=None)
if "example_css.css" not in html:
raise Exception(html)
raise AssertionError(html)
# fLOG(css)
if "<tr><th>Date</th><td>Sat, 1 Aug 2015" not in html and \
"<tr><th>Date</th><td>Fri, 14 Aug 2015" not in html and \
"<tr><th>Date</th><td>Fri, 20 Aug 2015" not in html and \
"<tr><th>Date</th><td>Sun, 20 Dec 2015" not in html:
raise Exception(html)
raise AssertionError(html)
fLOG(html)


Expand Down
8 changes: 4 additions & 4 deletions _unittests/ut_grabber/test_box_mock_render.py
Expand Up @@ -44,7 +44,7 @@ def tempf(message, location, prev_mail, next_mail):
exp = ('<a href="d_2015-08-01_p_noreply-at-voyages-sncf-com_ii_8de6a63addb7c03407bc6f0caabd967e.html">' +
'2015/08/01 -\n Voyages-sncf.com</a>')
if exp not in res[0]:
raise Exception(res[0])
raise AssertionError(res[0])

def test_box_mock_write(self):
fLOG(
Expand Down Expand Up @@ -73,17 +73,17 @@ def test_box_mock_write(self):
exp = ('<a href="d_2015-12-20_p_noreply-at-voyages-sncf-com_ii_1bb6fa70421145bed927e00c5e292277.html">' +
'2015/12/20 -\n Voyages-sncf.com</a>')
if exp not in content:
raise Exception(content)
raise AssertionError(content)
if 'list of mails</h1>' not in content:
raise Exception(content)
raise AssertionError(content)
allfiles = render.BufferWrite.listfiles()
assert len(allfiles) > 0

allfiles.sort()
with open(allfiles[0], "r", encoding="utf8") as f:
content = f.read()
if '<a href="d_2015-08-01_p_noreply-at-voyages-sncf-com_ii_8de6a63addb7c03407bc6f0caabd967e.html">&lt;--</a>' not in content:
raise Exception(content)
raise AssertionError(content)


if __name__ == "__main__":
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_grabber/test_mailbox_extended.py
Expand Up @@ -60,7 +60,7 @@ def test_mailbox_extended(self):
if "@" not in fr[1]:
issues.append(name)
if len(issues) > 0:
raise Exception("Issues with\n{0}".format(
raise AssertionError("Issues with\n{0}".format(
"\n".join(str(_) for _ in issues)))


Expand Down
8 changes: 4 additions & 4 deletions _unittests/ut_mails/test_email.py
Expand Up @@ -63,7 +63,7 @@ def test_load_email(self):
assert fro[0] == "matthieuyyyyy ."
assert fro[1] == "yyyyy.matthieu@xxxxx.xxx"
if obj.get_field("subject") != "projet 3A - élément logiciel":
raise Exception(
raise AssertionError(
"{0} != {1}".format(
obj.get_field("subject"),
"projet 3A - élément logiciel"))
Expand Down Expand Up @@ -112,11 +112,11 @@ def test_tohtml(self):
with open(ff[0][0], "r", encoding="utf8") as f:
content = f.read()
if '<link rel="stylesheet" type="text/css" href="mail_style.css">' not in content:
raise Exception(content)
raise AssertionError(content)
if "d_2014-12-15_p_yyyyy-matthieu-at-xxxxx-xxx_ii_48bdbc9f9fd180ab917cec5bed8ca529.html" not in ff[0][0]:
raise Exception(ff[0][0])
raise AssertionError(ff[0][0])
if "<h1>2014/12/15 - projet 3A - élément logiciel</h1>" not in content:
raise Exception(content)
raise AssertionError(content)

def test_decode_header(self):
fLOG(
Expand Down
2 changes: 1 addition & 1 deletion _unittests/ut_mails/test_regex.py
Expand Up @@ -43,7 +43,7 @@ def test_regular_expression(self):
assert "1146aa0a-244a-440e-8ea5-7b272c94f89a" not in em
exp = 'src="attachements/image.png"'
if exp not in em.replace("\\", "/"):
raise Exception(
raise AssertionError(
'string "attachements/image.png" not found in\n{0}'.format(em))


Expand Down
4 changes: 2 additions & 2 deletions src/pymmails/grabber/email_message.py
Expand Up @@ -161,7 +161,7 @@ def body_html(self):
try:
ht = b.decode("latin-1")
except UnicodeDecodeError:
raise Exception( # pylint: disable=W0707
raise AssertionError( # pylint: disable=W0707
"unable to decode %r: %r" % (chs[0], b))
else:
try:
Expand Down Expand Up @@ -266,7 +266,7 @@ def __lt__(self, at):
try:
return self.__sortkey__() < at.__sortkey__()
except TypeError as e:
raise Exception("issue with\n{0}\n{1}".format(
raise AssertionError("issue with\n{0}\n{1}".format(
self.__sortkey__(), at.__sortkey__())) from e

#: use for method @see me call_decode_header
Expand Down
4 changes: 2 additions & 2 deletions src/pymmails/sender/email_sender.py
Expand Up @@ -184,12 +184,12 @@ def f(fr=fr, to=to, astring=astring): # pylint: disable=W0102
try:
server.sendmail(fr, to, astring)
except Exception as e:
raise Exception(
raise AssertionError(
"Unable to send mail to {0} from '{1}'".format(to, fr)) from e
return f
else:
try:
return server.sendmail(fr, to, astring)
except Exception as e:
raise Exception(
raise AssertionError(
"Unable to send mail to {0} from '{1}'".format(to, fr)) from e

0 comments on commit c7492df

Please sign in to comment.