summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
authorR David Murray <rdmurray@bitdance.com>2014-09-20 22:05:28 (GMT)
committerR David Murray <rdmurray@bitdance.com>2014-09-20 22:05:28 (GMT)
commit8a97896a765e4b1ef8753b4a410a8f3e981cb9b8 (patch)
treef21bd8d39436e5bb9b8d8937511fbcaab2ddcff6 /Lib/test
parent97dfad7856df5d9c681fa74d576a23247cc55a33 (diff)
downloadcpython-8a97896a765e4b1ef8753b4a410a8f3e981cb9b8.zip
cpython-8a97896a765e4b1ef8753b4a410a8f3e981cb9b8.tar.gz
cpython-8a97896a765e4b1ef8753b4a410a8f3e981cb9b8.tar.bz2
#21091: make is_attachment a method.
Since EmailMessage is a provisional API we can fix API bugs in a maintenance release, but I used a trick suggested by Serhiy to maintain backward compatibility with 3.4.0/1.
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email/test_message.py20
1 files changed, 15 insertions, 5 deletions
diff --git a/Lib/test/test_email/test_message.py b/Lib/test/test_email/test_message.py
index 51ddf36..50e1a63 100644
--- a/Lib/test/test_email/test_message.py
+++ b/Lib/test/test_email/test_message.py
@@ -722,15 +722,25 @@ class TestEmailMessageBase:
def test_is_attachment(self):
m = self._make_message()
- self.assertFalse(m.is_attachment)
+ self.assertFalse(m.is_attachment())
+ with self.assertWarns(DeprecationWarning):
+ self.assertFalse(m.is_attachment)
m['Content-Disposition'] = 'inline'
- self.assertFalse(m.is_attachment)
+ self.assertFalse(m.is_attachment())
+ with self.assertWarns(DeprecationWarning):
+ self.assertFalse(m.is_attachment)
m.replace_header('Content-Disposition', 'attachment')
- self.assertTrue(m.is_attachment)
+ self.assertTrue(m.is_attachment())
+ with self.assertWarns(DeprecationWarning):
+ self.assertTrue(m.is_attachment)
m.replace_header('Content-Disposition', 'AtTachMent')
- self.assertTrue(m.is_attachment)
+ self.assertTrue(m.is_attachment())
+ with self.assertWarns(DeprecationWarning):
+ self.assertTrue(m.is_attachment)
m.set_param('filename', 'abc.png', 'Content-Disposition')
- self.assertTrue(m.is_attachment)
+ self.assertTrue(m.is_attachment())
+ with self.assertWarns(DeprecationWarning):
+ self.assertTrue(m.is_attachment)
class TestEmailMessage(TestEmailMessageBase, TestEmailBase):