(self, body, expected_encoded_body, maxlinelen=None, eol=None)
| 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('', '') |
no test coverage detected