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

Method test_encode

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

Source from the content-addressed store, hash-verified

4996 self.assertRaises(ValueError, self._test_encode, '', '', maxlinelen=3)
4997
4998 def test_encode(self):
4999 eq = self.assertEqual
5000 eq(quoprimime.body_encode(''), '')
5001 eq(quoprimime.body_encode('hello'), 'hello')
5002 # Test the binary flag
5003 eq(quoprimime.body_encode('hello\r\nworld'), 'hello\nworld')
5004 # Test the maxlinelen arg
5005 eq(quoprimime.body_encode('xxxx ' * 20, maxlinelen=40), """\
5006xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=
5007 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=
5008x xxxx xxxx xxxx xxxx=20""")
5009 # Test the eol argument
5010 eq(quoprimime.body_encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'),
5011 """\
5012xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=\r
5013 xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=\r
5014x xxxx xxxx xxxx xxxx=20""")
5015 eq(quoprimime.body_encode("""\
5016one line
5017
5018two line"""), """\
5019one line
5020
5021two line""")
5022
5023
5024

Callers

nothing calls this directly

Calls 2

body_encodeMethod · 0.80
eqFunction · 0.50

Tested by

no test coverage detected