MCPcopy Index your code
hub / github.com/RustPython/RustPython / setUp

Method setUp

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

Source from the content-addressed store, hash-verified

1849# Test complicated multipart/* messages
1850class TestMultipart(TestEmailBase):
1851 def setUp(self):
1852 with openfile('python.gif', 'rb') as fp:
1853 data = fp.read()
1854 container = MIMEBase('multipart', 'mixed', boundary='BOUNDARY')
1855 image = MIMEImage(data, name='dingusfish.gif')
1856 image.add_header('content-disposition', 'attachment',
1857 filename='dingusfish.gif')
1858 intro = MIMEText('''\
1859Hi there,
1860
1861This is the dingus fish.
1862''')
1863 container.attach(intro)
1864 container.attach(image)
1865 container['From'] = 'Barry <barry@digicool.com>'
1866 container['To'] = 'Dingus Lovers <cravindogs@cravindogs.com>'
1867 container['Subject'] = 'Here is your dingus fish'
1868
1869 now = 987809702.54848599
1870 timetuple = time.localtime(now)
1871 if timetuple[-1] == 0:
1872 tzsecs = time.timezone
1873 else:
1874 tzsecs = time.altzone
1875 if tzsecs > 0:
1876 sign = '-'
1877 else:
1878 sign = '+'
1879 tzoffset = ' %s%04d' % (sign, tzsecs / 36)
1880 container['Date'] = time.strftime(
1881 '%a, %d %b %Y %H:%M:%S',
1882 time.localtime(now)) + tzoffset
1883 self._msg = container
1884 self._im = image
1885 self._txt = intro
1886
1887 def test_hierarchy(self):
1888 # 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