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

Method _test_encode

Lib/test/test_email/test_email.py:4901–4919  ·  view source on GitHub ↗
(self, body, expected_encoded_body, maxlinelen=None, eol=None)

Source from the content-addressed store, hash-verified

4899 self._test_decode('A=1,B=A ==> A+B==2', 'A=1,B=A ==> A+B==2')
4900
4901 def _test_encode(self, body, expected_encoded_body, maxlinelen=None, eol=None):
4902 kwargs = {}
4903 if maxlinelen is None:
4904 # Use body_encode's default.
4905 maxlinelen = 76
4906 else:
4907 kwargs['maxlinelen'] = maxlinelen
4908 if eol is None:
4909 # Use body_encode's default.
4910 eol = '\n'
4911 else:
4912 kwargs['eol'] = eol
4913 encoded_body = quoprimime.body_encode(body, **kwargs)
4914 self.assertEqual(encoded_body, expected_encoded_body)
4915 if eol == '\n' or eol == '\r\n':
4916 # We know how to split the result back into lines, so maxlinelen
4917 # can be checked.
4918 for line in encoded_body.splitlines():
4919 self.assertLessEqual(len(line), maxlinelen)
4920
4921 def test_encode_null(self):
4922 self._test_encode('', '')

Calls 5

lenFunction · 0.85
body_encodeMethod · 0.80
assertLessEqualMethod · 0.80
assertEqualMethod · 0.45
splitlinesMethod · 0.45

Tested by

no test coverage detected