Skip to content

Commit 2f6a0b0

Browse files
committed
Add a test for get_all() returning failobj. msg_20.txt is a sample
message with multiple CC: fields, used in the get_all() test.
1 parent 9300a75 commit 2f6a0b0

File tree

2 files changed

+28
-0
lines changed

2 files changed

+28
-0
lines changed

Lib/test/data/msg_20.txt

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
Return-Path: <bbb@zzz.org>
2+
Delivered-To: bbb@zzz.org
3+
Received: by mail.zzz.org (Postfix, from userid 889)
4+
id 27CEAD38CC; Fri, 4 May 2001 14:05:44 -0400 (EDT)
5+
MIME-Version: 1.0
6+
Content-Type: text/plain; charset=us-ascii
7+
Content-Transfer-Encoding: 7bit
8+
Message-ID: <15090.61304.110929.45684@aaa.zzz.org>
9+
From: bbb@ddd.com (John X. Doe)
10+
To: bbb@zzz.org
11+
Cc: ccc@zzz.org
12+
CC: ddd@zzz.org
13+
cc: eee@zzz.org
14+
Subject: This is a test message
15+
Date: Fri, 4 May 2001 14:05:44 -0400
16+
17+
18+
Hi,
19+
20+
Do you like this message?
21+
22+
-Me

Lib/test/test_email.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,12 @@ def _msgobj(self, filename):
5050

5151
# Test various aspects of the Message class's API
5252
class TestMessageAPI(TestEmailBase):
53+
def test_get_all(self):
54+
eq = self.assertEqual
55+
msg = self._msgobj('msg_20.txt')
56+
eq(msg.get_all('cc'), ['ccc@zzz.org', 'ddd@zzz.org', 'eee@zzz.org'])
57+
eq(msg.get_all('xx', 'n/a'), 'n/a')
58+
5359
def test_get_charsets(self):
5460
eq = self.assertEqual
5561

0 commit comments

Comments
 (0)