message is re-defining a name which is already available in the outer-scope (previously defined on line 13).
It is generally a bad practice to shadow variables from the outer-scope. In most
cases, this is done unintentionally and might lead to unexpected behavior:
param=5classFoo:def__init__(self,param):# "param" would be flagged hereself.param=param
Loading history...
21
""" Test that a message can be created and added to directly """
22
msg = message
23
24
msg_string = str(msg)
25
assert '# A Test Message' in msg_string
26
assert 'This message is only a test of the alert system' in msg_string
27
28
msg_html = msg.html
29
assert '<html>' in msg_html
30
assert '<head></head>' in msg_html
31
assert '<body>' in msg_html
32
assert 'style="color:blue">' in msg_html
33
assert 'A Test Message' in msg_html
34
assert '<p>This message is only a test of the alert system' in msg_html
35
36
37
def test_empty_message():
38
""" Test that a message passed an empty body gets created """
message is re-defining a name which is already available in the outer-scope (previously defined on line 13).
It is generally a bad practice to shadow variables from the outer-scope. In most
cases, this is done unintentionally and might lead to unexpected behavior:
param=5classFoo:def__init__(self,param):# "param" would be flagged hereself.param=param
Loading history...
48
""" Test that a message can form a valid MIMEMultiPart object """
49
mime = message.mime()
50
mime_string = str(mime)
51
assert 'Content-Type' in mime_string
52
assert 'multipart/alternative' in mime_string
53
#assert 'From' in mime_string
54
assert 'MIME-Version:' in mime_string
55
assert 'Content-Type: text/plain; charset="us-ascii"' in mime_string
56
assert '# A Test Message' in mime_string
57
assert 'Content-Type: text/html; charset="us-ascii"' in mime_string
58
assert '<h1 style="color:blue">A Test Message</h1>' in mime_string