(self)
| 4926 | self.assertRaises(ValueError, self._test_encode, '', '', maxlinelen=3) |
| 4927 | |
| 4928 | def test_encode(self): |
| 4929 | eq = self.assertEqual |
| 4930 | eq(quoprimime.body_encode(''), '') |
| 4931 | eq(quoprimime.body_encode('hello'), 'hello') |
| 4932 | # Test the binary flag |
| 4933 | eq(quoprimime.body_encode('hello\r\nworld'), 'hello\nworld') |
| 4934 | # Test the maxlinelen arg |
| 4935 | eq(quoprimime.body_encode('xxxx ' * 20, maxlinelen=40), """\ |
| 4936 | xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx= |
| 4937 | xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx= |
| 4938 | x xxxx xxxx xxxx xxxx=20""") |
| 4939 | # Test the eol argument |
| 4940 | eq(quoprimime.body_encode('xxxx ' * 20, maxlinelen=40, eol='\r\n'), |
| 4941 | """\ |
| 4942 | xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxxx=\r |
| 4943 | xxxx xxxx xxxx xxxx xxxx xxxx xxxx xxx=\r |
| 4944 | x xxxx xxxx xxxx xxxx=20""") |
| 4945 | eq(quoprimime.body_encode("""\ |
| 4946 | one line |
| 4947 | |
| 4948 | two line"""), """\ |
| 4949 | one line |
| 4950 | |
| 4951 | two line""") |
| 4952 | |
| 4953 | |
| 4954 |
nothing calls this directly
no test coverage detected