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

Method test_as_bytes

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 9

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

Tested by

no test coverage detected