diff options
author | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-21 13:34:58 (GMT) |
---|---|---|
committer | Ezio Melotti <ezio.melotti@gmail.com> | 2010-11-21 13:34:58 (GMT) |
commit | 2623a37852153363335956afab010cb0beb7e74e (patch) | |
tree | e443a19bb7a87adc2158ef2e32da5c2f3b21936c /Lib/email/test | |
parent | 40a92f5c65767d80ebc3b3be2c2ccfc5db3afb7b (diff) | |
download | cpython-2623a37852153363335956afab010cb0beb7e74e.zip cpython-2623a37852153363335956afab010cb0beb7e74e.tar.gz cpython-2623a37852153363335956afab010cb0beb7e74e.tar.bz2 |
Merged revisions 86596 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/branches/py3k
........
r86596 | ezio.melotti | 2010-11-20 21:04:17 +0200 (Sat, 20 Nov 2010) | 1 line
#9424: Replace deprecated assert* methods in the Python test suite.
........
Diffstat (limited to 'Lib/email/test')
-rw-r--r-- | Lib/email/test/test_email.py | 60 | ||||
-rw-r--r-- | Lib/email/test/test_email_renamed.py | 60 |
2 files changed, 60 insertions, 60 deletions
diff --git a/Lib/email/test/test_email.py b/Lib/email/test/test_email.py index 58edd0c..d93287a 100644 --- a/Lib/email/test/test_email.py +++ b/Lib/email/test/test_email.py @@ -40,13 +40,13 @@ EMPTYSTRING = '' SPACE = ' ' - + def openfile(filename, mode='r'): path = os.path.join(os.path.dirname(landmark), 'data', filename) return open(path, mode) - + # Base test class class TestEmailBase(unittest.TestCase): def ndiffAssertEqual(self, first, second): @@ -68,7 +68,7 @@ class TestEmailBase(unittest.TestCase): return msg - + # Test various aspects of the Message class's API class TestMessageAPI(TestEmailBase): def test_get_all(self): @@ -543,7 +543,7 @@ class TestMessageAPI(TestEmailBase): self.assertEqual('us-ascii', msg.get_content_charset()) - + # Test the email.Encoders module class TestEncoders(unittest.TestCase): def test_encode_empty_payload(self): @@ -572,7 +572,7 @@ class TestEncoders(unittest.TestCase): msg = email.MIMEText.MIMEText('\xca\xb8', _charset='euc-jp') eq(msg['content-transfer-encoding'], '7bit') - + # Test long header wrapping class TestLongHeaders(TestEmailBase): def test_split_long_continuation(self): @@ -893,7 +893,7 @@ List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassass """) - + # Test mangling of "From " lines in the body of a message class TestFromMangling(unittest.TestCase): def setUp(self): @@ -927,7 +927,7 @@ Blah blah blah """) - + # Test the basic MIMEAudio class class TestMIMEAudio(unittest.TestCase): def setUp(self): @@ -976,7 +976,7 @@ class TestMIMEAudio(unittest.TestCase): header='foobar') is missing) - + # Test the basic MIMEImage class class TestMIMEImage(unittest.TestCase): def setUp(self): @@ -1019,7 +1019,7 @@ class TestMIMEImage(unittest.TestCase): header='foobar') is missing) - + # Test the basic MIMEText class class TestMIMEText(unittest.TestCase): def setUp(self): @@ -1071,7 +1071,7 @@ class TestMIMEText(unittest.TestCase): self.assertRaises(UnicodeEncodeError, MIMEText, teststr) - + # Test complicated multipart/* messages class TestMultipart(TestEmailBase): def setUp(self): @@ -1447,10 +1447,10 @@ Content-Transfer-Encoding: base64 YXNkZg== --===============0012394164==--""") - self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==') + self.assertEqual(m.get_payload(0).get_payload(), 'YXNkZg==') + - # Test some badly formatted messages class TestNonConformant(TestEmailBase): def test_parse_missing_minor_type(self): @@ -1565,7 +1565,7 @@ counter to RFC 2822, there's no separating newline here - + # Test RFC 2047 header encoding and decoding class TestRFC2047(unittest.TestCase): def test_rfc2047_multiline(self): @@ -1627,7 +1627,7 @@ class TestRFC2047(unittest.TestCase): self.assertEqual(decode_header(s), [(b'andr\xe9=zz', 'iso-8659-1')]) - + # Test the MIMEMessage class class TestMIMEMessage(TestEmailBase): def setUp(self): @@ -1940,7 +1940,7 @@ message 2 msg = MIMEMultipart() self.assertTrue(msg.is_multipart()) - + # A general test of parser->model->generator idempotency. IOW, read a message # in, parse it into a message object tree, then without touching the tree, # regenerate the plain text. The original text and the transformed text @@ -1964,7 +1964,7 @@ class TestIdempotent(TestEmailBase): eq(text, s.getvalue()) def test_parse_text_message(self): - eq = self.assertEquals + eq = self.assertEqual msg, text = self._msgobj('msg_01.txt') eq(msg.get_content_type(), 'text/plain') eq(msg.get_content_maintype(), 'text') @@ -1976,7 +1976,7 @@ class TestIdempotent(TestEmailBase): self._idempotent(msg, text) def test_parse_untyped_message(self): - eq = self.assertEquals + eq = self.assertEqual msg, text = self._msgobj('msg_03.txt') eq(msg.get_content_type(), 'text/plain') eq(msg.get_params(), None) @@ -2048,7 +2048,7 @@ class TestIdempotent(TestEmailBase): self._idempotent(msg, text) def test_content_type(self): - eq = self.assertEquals + eq = self.assertEqual unless = self.assertTrue # Get a message object and reset the seek pointer for other tests msg, text = self._msgobj('msg_05.txt') @@ -2080,7 +2080,7 @@ class TestIdempotent(TestEmailBase): eq(msg4.get_payload(), 'Yadda yadda yadda\n') def test_parser(self): - eq = self.assertEquals + eq = self.assertEqual unless = self.assertTrue msg, text = self._msgobj('msg_06.txt') # Check some of the outer headers @@ -2097,7 +2097,7 @@ class TestIdempotent(TestEmailBase): eq(msg1.get_payload(), '\n') - + # Test various other bits of the package's functionality class TestMiscellaneous(TestEmailBase): def test_message_from_string(self): @@ -2452,7 +2452,7 @@ multipart/report """) - + # Test the iterator/generators class TestIterators(TestEmailBase): def test_body_line_iterator(self): @@ -2545,7 +2545,7 @@ Do you like this message? self.assertTrue(''.join([il for il, n in imt]) == ''.join(om)) - + class TestParsers(TestEmailBase): def test_header_parser(self): eq = self.assertEqual @@ -2708,7 +2708,7 @@ Here's the message body msg = email.message_from_string(m) self.assertTrue(msg.get_payload(0).get_payload().endswith('\r\n')) - + class TestBase64(unittest.TestCase): def test_len(self): eq = self.assertEqual @@ -2780,7 +2780,7 @@ eHh4eCB4eHh4IA==\r =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - + class TestQuopri(unittest.TestCase): def setUp(self): self.hlit = [chr(x) for x in range(ord('a'), ord('z')+1)] + \ @@ -2890,7 +2890,7 @@ one line two line""") - + # Test the Charset class class TestCharset(unittest.TestCase): def tearDown(self): @@ -2951,7 +2951,7 @@ class TestCharset(unittest.TestCase): charset = Charset('utf8') self.assertEqual(str(charset), 'utf-8') - + # Test multilingual MIME headers. class TestHeader(TestEmailBase): def test_simple(self): @@ -3114,7 +3114,7 @@ A very long line that must get split to something other than at the raises(Errors.HeaderParseError, decode_header, s) - + # Test RFC 2231 header parameters (en/de)coding class TestRFC2231(TestEmailBase): def test_get_param(self): @@ -3426,7 +3426,7 @@ Content-Type: application/x-foo; eq(s, 'My Document For You') - + # Tests to ensure that signed parts of an email are completely preserved, as # required by RFC1847 section 2.1. Note that these are incomplete, because the # email package does not currently always preserve the body. See issue 1670765. @@ -3462,7 +3462,7 @@ class TestSigned(TestEmailBase): self._signed_parts_eq(original, result) - + def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] @@ -3480,6 +3480,6 @@ def test_main(): run_unittest(testclass) - + if __name__ == '__main__': unittest.main(defaultTest='suite') diff --git a/Lib/email/test/test_email_renamed.py b/Lib/email/test/test_email_renamed.py index 481c40f..497b66b 100644 --- a/Lib/email/test/test_email_renamed.py +++ b/Lib/email/test/test_email_renamed.py @@ -41,13 +41,13 @@ EMPTYSTRING = '' SPACE = ' ' - + def openfile(filename, mode='r'): path = os.path.join(os.path.dirname(landmark), 'data', filename) return open(path, mode) - + # Base test class class TestEmailBase(unittest.TestCase): def ndiffAssertEqual(self, first, second): @@ -69,7 +69,7 @@ class TestEmailBase(unittest.TestCase): return msg - + # Test various aspects of the Message class's API class TestMessageAPI(TestEmailBase): def test_get_all(self): @@ -504,7 +504,7 @@ class TestMessageAPI(TestEmailBase): self.assertEqual(msg.get_payload(decode=True), x) - + # Test the email.encoders module class TestEncoders(unittest.TestCase): def test_encode_empty_payload(self): @@ -531,7 +531,7 @@ class TestEncoders(unittest.TestCase): eq(msg['content-transfer-encoding'], 'quoted-printable') - + # Test long header wrapping class TestLongHeaders(TestEmailBase): def test_split_long_continuation(self): @@ -852,7 +852,7 @@ List: List-Unsubscribe: <https://lists.sourceforge.net/lists/listinfo/spamassass """) - + # Test mangling of "From " lines in the body of a message class TestFromMangling(unittest.TestCase): def setUp(self): @@ -886,7 +886,7 @@ Blah blah blah """) - + # Test the basic MIMEAudio class class TestMIMEAudio(unittest.TestCase): def setUp(self): @@ -935,7 +935,7 @@ class TestMIMEAudio(unittest.TestCase): header='foobar') is missing) - + # Test the basic MIMEImage class class TestMIMEImage(unittest.TestCase): def setUp(self): @@ -978,7 +978,7 @@ class TestMIMEImage(unittest.TestCase): header='foobar') is missing) - + # Test the basic MIMEApplication class class TestMIMEApplication(unittest.TestCase): def test_headers(self): @@ -995,7 +995,7 @@ class TestMIMEApplication(unittest.TestCase): eq(msg.get_payload(decode=True), bytes) - + # Test the basic MIMEText class class TestMIMEText(unittest.TestCase): def setUp(self): @@ -1022,7 +1022,7 @@ class TestMIMEText(unittest.TestCase): eq(msg['content-type'], 'text/plain; charset="us-ascii"') - + # Test complicated multipart/* messages class TestMultipart(TestEmailBase): def setUp(self): @@ -1398,10 +1398,10 @@ Content-Transfer-Encoding: base64 YXNkZg== --===============0012394164==--""") - self.assertEquals(m.get_payload(0).get_payload(), 'YXNkZg==') + self.assertEqual(m.get_payload(0).get_payload(), 'YXNkZg==') + - # Test some badly formatted messages class TestNonConformant(TestEmailBase): def test_parse_missing_minor_type(self): @@ -1515,7 +1515,7 @@ counter to RFC 2822, there's no separating newline here eq(msg.defects[0].line, ' Line 1\n') - + # Test RFC 2047 header encoding and decoding class TestRFC2047(unittest.TestCase): def test_rfc2047_multiline(self): @@ -1562,7 +1562,7 @@ class TestRFC2047(unittest.TestCase): ('sbord', None)]) - + # Test the MIMEMessage class class TestMIMEMessage(TestEmailBase): def setUp(self): @@ -1872,7 +1872,7 @@ message 2 eq(msg.get_payload(1), text2) - + # A general test of parser->model->generator idempotency. IOW, read a message # in, parse it into a message object tree, then without touching the tree, # regenerate the plain text. The original text and the transformed text @@ -1896,7 +1896,7 @@ class TestIdempotent(TestEmailBase): eq(text, s.getvalue()) def test_parse_text_message(self): - eq = self.assertEquals + eq = self.assertEqual msg, text = self._msgobj('msg_01.txt') eq(msg.get_content_type(), 'text/plain') eq(msg.get_content_maintype(), 'text') @@ -1908,7 +1908,7 @@ class TestIdempotent(TestEmailBase): self._idempotent(msg, text) def test_parse_untyped_message(self): - eq = self.assertEquals + eq = self.assertEqual msg, text = self._msgobj('msg_03.txt') eq(msg.get_content_type(), 'text/plain') eq(msg.get_params(), None) @@ -1980,7 +1980,7 @@ class TestIdempotent(TestEmailBase): self._idempotent(msg, text) def test_content_type(self): - eq = self.assertEquals + eq = self.assertEqual unless = self.assertTrue # Get a message object and reset the seek pointer for other tests msg, text = self._msgobj('msg_05.txt') @@ -2012,7 +2012,7 @@ class TestIdempotent(TestEmailBase): eq(msg4.get_payload(), 'Yadda yadda yadda\n') def test_parser(self): - eq = self.assertEquals + eq = self.assertEqual unless = self.assertTrue msg, text = self._msgobj('msg_06.txt') # Check some of the outer headers @@ -2029,7 +2029,7 @@ class TestIdempotent(TestEmailBase): eq(msg1.get_payload(), '\n') - + # Test various other bits of the package's functionality class TestMiscellaneous(TestEmailBase): def test_message_from_string(self): @@ -2354,7 +2354,7 @@ multipart/report """) - + # Test the iterator/generators class TestIterators(TestEmailBase): def test_body_line_iterator(self): @@ -2414,7 +2414,7 @@ Do you like this message? """) - + class TestParsers(TestEmailBase): def test_header_parser(self): eq = self.assertEqual @@ -2559,7 +2559,7 @@ Here's the message body eq(msg.get_payload(), 'body') - + class TestBase64(unittest.TestCase): def test_len(self): eq = self.assertEqual @@ -2631,7 +2631,7 @@ eHh4eCB4eHh4IA==\r =?iso-8859-1?b?eHh4eCB4eHh4IHh4eHgg?=""") - + class TestQuopri(unittest.TestCase): def setUp(self): self.hlit = [chr(x) for x in range(ord('a'), ord('z')+1)] + \ @@ -2741,7 +2741,7 @@ one line two line""") - + # Test the Charset class class TestCharset(unittest.TestCase): def tearDown(self): @@ -2799,7 +2799,7 @@ class TestCharset(unittest.TestCase): self.assertRaises(errors.CharsetError, Charset, 'asc\xffii') - + # Test multilingual MIME headers. class TestHeader(TestEmailBase): def test_simple(self): @@ -2962,7 +2962,7 @@ A very long line that must get split to something other than at the raises(errors.HeaderParseError, decode_header, s) - + # Test RFC 2231 header parameters (en/de)coding class TestRFC2231(TestEmailBase): def test_get_param(self): @@ -3274,7 +3274,7 @@ Content-Type: application/x-foo; eq(s, 'My Document For You') - + def _testclasses(): mod = sys.modules[__name__] return [getattr(mod, name) for name in dir(mod) if name.startswith('Test')] @@ -3292,6 +3292,6 @@ def test_main(): run_unittest(testclass) - + if __name__ == '__main__': unittest.main(defaultTest='suite') |