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

Method test_as_bytes

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

Source from the content-addressed store, hash-verified

367 self.assertEqual(msg.as_string(), expected)
368
369 def test_as_bytes(self):
370 msg = self._msgobj('msg_01.txt')
371 with openfile('msg_01.txt', encoding="utf-8") as fp:
372 data = fp.read().encode('ascii')
373 self.assertEqual(data, bytes(msg))
374 fullrepr = msg.as_bytes(unixfrom=True)
375 lines = fullrepr.split(b'\n')
376 self.assertStartsWith(lines[0], b'From ')
377 self.assertEqual(data, b'\n'.join(lines[1:]))
378
379 def test_as_bytes_policy(self):
380 msg = self._msgobj('msg_01.txt')

Callers

nothing calls this directly

Calls 9

openfileFunction · 0.90
as_bytesMethod · 0.80
assertStartsWithMethod · 0.80
_msgobjMethod · 0.45
encodeMethod · 0.45
readMethod · 0.45
assertEqualMethod · 0.45
splitMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected