summaryrefslogtreecommitdiffstats
path: root/Lib/test
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test')
-rw-r--r--Lib/test/test_email/data/PyBanner048.gifbin896 -> 0 bytes
-rw-r--r--Lib/test/test_email/data/python.bmpbin0 -> 1162 bytes
-rw-r--r--Lib/test/test_email/data/python.exrbin0 -> 2635 bytes
-rw-r--r--Lib/test/test_email/data/python.gifbin0 -> 405 bytes
-rw-r--r--Lib/test/test_email/data/python.jpgbin0 -> 543 bytes
-rw-r--r--Lib/test/test_email/data/python.pbm3
-rw-r--r--Lib/test/test_email/data/python.pgmbin0 -> 269 bytes
-rw-r--r--Lib/test/test_email/data/python.pngbin0 -> 1020 bytes
-rw-r--r--Lib/test/test_email/data/python.ppmbin0 -> 781 bytes
-rw-r--r--Lib/test/test_email/data/python.rasbin0 -> 1056 bytes
-rw-r--r--Lib/test/test_email/data/python.sgibin0 -> 1967 bytes
-rw-r--r--Lib/test/test_email/data/python.tiffbin0 -> 1326 bytes
-rw-r--r--Lib/test/test_email/data/python.webpbin0 -> 432 bytes
-rw-r--r--Lib/test/test_email/data/python.xbm6
-rw-r--r--Lib/test/test_email/test_email.py34
15 files changed, 36 insertions, 7 deletions
diff --git a/Lib/test/test_email/data/PyBanner048.gif b/Lib/test/test_email/data/PyBanner048.gif
deleted file mode 100644
index 7e308f5..0000000
--- a/Lib/test/test_email/data/PyBanner048.gif
+++ /dev/null
Binary files differ
diff --git a/Lib/test/test_email/data/python.bmp b/Lib/test/test_email/data/python.bmp
new file mode 100644
index 0000000..675f951
--- /dev/null
+++ b/Lib/test/test_email/data/python.bmp
Binary files differ
diff --git a/Lib/test/test_email/data/python.exr b/Lib/test/test_email/data/python.exr
new file mode 100644
index 0000000..773c81e
--- /dev/null
+++ b/Lib/test/test_email/data/python.exr
Binary files differ
diff --git a/Lib/test/test_email/data/python.gif b/Lib/test/test_email/data/python.gif
new file mode 100644
index 0000000..efa0be3
--- /dev/null
+++ b/Lib/test/test_email/data/python.gif
Binary files differ
diff --git a/Lib/test/test_email/data/python.jpg b/Lib/test/test_email/data/python.jpg
new file mode 100644
index 0000000..21222c0
--- /dev/null
+++ b/Lib/test/test_email/data/python.jpg
Binary files differ
diff --git a/Lib/test/test_email/data/python.pbm b/Lib/test/test_email/data/python.pbm
new file mode 100644
index 0000000..1848ba7
--- /dev/null
+++ b/Lib/test/test_email/data/python.pbm
@@ -0,0 +1,3 @@
+P4
+16 16
+ûñ¿úßÕ­±[ñ¥a_ÁX°°ðððð?ÿÿ \ No newline at end of file
diff --git a/Lib/test/test_email/data/python.pgm b/Lib/test/test_email/data/python.pgm
new file mode 100644
index 0000000..8349f2a
--- /dev/null
+++ b/Lib/test/test_email/data/python.pgm
Binary files differ
diff --git a/Lib/test/test_email/data/python.png b/Lib/test/test_email/data/python.png
new file mode 100644
index 0000000..1a987f7
--- /dev/null
+++ b/Lib/test/test_email/data/python.png
Binary files differ
diff --git a/Lib/test/test_email/data/python.ppm b/Lib/test/test_email/data/python.ppm
new file mode 100644
index 0000000..7d9cdb3
--- /dev/null
+++ b/Lib/test/test_email/data/python.ppm
Binary files differ
diff --git a/Lib/test/test_email/data/python.ras b/Lib/test/test_email/data/python.ras
new file mode 100644
index 0000000..130e96f
--- /dev/null
+++ b/Lib/test/test_email/data/python.ras
Binary files differ
diff --git a/Lib/test/test_email/data/python.sgi b/Lib/test/test_email/data/python.sgi
new file mode 100644
index 0000000..ffe9081
--- /dev/null
+++ b/Lib/test/test_email/data/python.sgi
Binary files differ
diff --git a/Lib/test/test_email/data/python.tiff b/Lib/test/test_email/data/python.tiff
new file mode 100644
index 0000000..39d0bfc
--- /dev/null
+++ b/Lib/test/test_email/data/python.tiff
Binary files differ
diff --git a/Lib/test/test_email/data/python.webp b/Lib/test/test_email/data/python.webp
new file mode 100644
index 0000000..e824ec7
--- /dev/null
+++ b/Lib/test/test_email/data/python.webp
Binary files differ
diff --git a/Lib/test/test_email/data/python.xbm b/Lib/test/test_email/data/python.xbm
new file mode 100644
index 0000000..cfbee2e
--- /dev/null
+++ b/Lib/test/test_email/data/python.xbm
@@ -0,0 +1,6 @@
+#define python_width 16
+#define python_height 16
+static char python_bits[] = {
+ 0xDF, 0xFE, 0x8F, 0xFD, 0x5F, 0xFB, 0xAB, 0xFE, 0xB5, 0x8D, 0xDA, 0x8F,
+ 0xA5, 0x86, 0xFA, 0x83, 0x1A, 0x80, 0x0D, 0x80, 0x0D, 0x80, 0x0F, 0xE0,
+ 0x0F, 0xF8, 0x0F, 0xF8, 0x0F, 0xFC, 0xFF, 0xFF, };
diff --git a/Lib/test/test_email/test_email.py b/Lib/test/test_email/test_email.py
index b87dae2..6ead594 100644
--- a/Lib/test/test_email/test_email.py
+++ b/Lib/test/test_email/test_email.py
@@ -798,7 +798,7 @@ class TestMessageAPI(TestEmailBase):
class TestEncoders(unittest.TestCase):
def test_EncodersEncode_base64(self):
- with openfile('PyBanner048.gif', 'rb') as fp:
+ with openfile('python.gif', 'rb') as fp:
bindata = fp.read()
mimed = email.mime.image.MIMEImage(bindata)
base64ed = mimed.get_payload()
@@ -1555,24 +1555,44 @@ class TestMIMEAudio(unittest.TestCase):
# Test the basic MIMEImage class
class TestMIMEImage(unittest.TestCase):
- def setUp(self):
- with openfile('PyBanner048.gif', 'rb') as fp:
+ def _make_image(self, ext):
+ with openfile(f'python.{ext}', 'rb') as fp:
self._imgdata = fp.read()
self._im = MIMEImage(self._imgdata)
def test_guess_minor_type(self):
- self.assertEqual(self._im.get_content_type(), 'image/gif')
+ for ext, subtype in {
+ 'bmp': None,
+ 'exr': None,
+ 'gif': None,
+ 'jpg': 'jpeg',
+ 'pbm': None,
+ 'pgm': None,
+ 'png': None,
+ 'ppm': None,
+ 'ras': 'rast',
+ 'sgi': 'rgb',
+ 'tiff': None,
+ 'webp': None,
+ 'xbm': None,
+ }.items():
+ self._make_image(ext)
+ subtype = ext if subtype is None else subtype
+ self.assertEqual(self._im.get_content_type(), f'image/{subtype}')
def test_encoding(self):
+ self._make_image('gif')
payload = self._im.get_payload()
self.assertEqual(base64.decodebytes(bytes(payload, 'ascii')),
- self._imgdata)
+ self._imgdata)
def test_checkSetMinor(self):
+ self._make_image('gif')
im = MIMEImage(self._imgdata, 'fish')
self.assertEqual(im.get_content_type(), 'image/fish')
def test_add_header(self):
+ self._make_image('gif')
eq = self.assertEqual
self._im.add_header('Content-Disposition', 'attachment',
filename='dingusfish.gif')
@@ -1747,7 +1767,7 @@ class TestMIMEText(unittest.TestCase):
# Test complicated multipart/* messages
class TestMultipart(TestEmailBase):
def setUp(self):
- with openfile('PyBanner048.gif', 'rb') as fp:
+ with openfile('python.gif', 'rb') as fp:
data = fp.read()
container = MIMEBase('multipart', 'mixed', boundary='BOUNDARY')
image = MIMEImage(data, name='dingusfish.gif')
@@ -3444,7 +3464,7 @@ multipart/report
def test_mime_classes_policy_argument(self):
with openfile('audiotest.au', 'rb') as fp:
audiodata = fp.read()
- with openfile('PyBanner048.gif', 'rb') as fp:
+ with openfile('python.gif', 'rb') as fp:
bindata = fp.read()
classes = [
(MIMEApplication, ('',)),