MCPcopy Index your code
hub / github.com/python/cpython / setUp

Method setUp

Lib/test/test_email/test_email.py:1873–1907  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

1871# Test complicated multipart/* messages
1872class TestMultipart(TestEmailBase):
1873 def setUp(self):
1874 with openfile('python.gif', 'rb') as fp:
1875 data = fp.read()
1876 container = MIMEBase('multipart', 'mixed', boundary='BOUNDARY')
1877 image = MIMEImage(data, name='dingusfish.gif')
1878 image.add_header('content-disposition', 'attachment',
1879 filename='dingusfish.gif')
1880 intro = MIMEText('''\
1881Hi there,
1882
1883This is the dingus fish.
1884''')
1885 container.attach(intro)
1886 container.attach(image)
1887 container['From'] = 'Barry <barry@digicool.com>'
1888 container['To'] = 'Dingus Lovers <cravindogs@cravindogs.com>'
1889 container['Subject'] = 'Here is your dingus fish'
1890
1891 now = 987809702.54848599
1892 timetuple = time.localtime(now)
1893 if timetuple[-1] == 0:
1894 tzsecs = time.timezone
1895 else:
1896 tzsecs = time.altzone
1897 if tzsecs > 0:
1898 sign = '-'
1899 else:
1900 sign = '+'
1901 tzoffset = ' %s%04d' % (sign, tzsecs / 36)
1902 container['Date'] = time.strftime(
1903 '%a, %d %b %Y %H:%M:%S',
1904 time.localtime(now)) + tzoffset
1905 self._msg = container
1906 self._im = image
1907 self._txt = intro
1908
1909 def test_hierarchy(self):
1910 # convenience

Callers

nothing calls this directly

Calls 8

openfileFunction · 0.90
MIMEBaseClass · 0.90
MIMEImageClass · 0.90
MIMETextClass · 0.90
readMethod · 0.45
add_headerMethod · 0.45
attachMethod · 0.45
strftimeMethod · 0.45

Tested by

no test coverage detected