(self, body, expected_encoded_body, maxlinelen=None, eol=None)
| 4829 | self._test_decode('A=1,B=A ==> A+B==2', 'A=1,B=A ==> A+B==2') |
| 4830 | |
| 4831 | def _test_encode(self, body, expected_encoded_body, maxlinelen=None, eol=None): |
| 4832 | kwargs = {} |
| 4833 | if maxlinelen is None: |
| 4834 | # Use body_encode's default. |
| 4835 | maxlinelen = 76 |
| 4836 | else: |
| 4837 | kwargs['maxlinelen'] = maxlinelen |
| 4838 | if eol is None: |
| 4839 | # Use body_encode's default. |
| 4840 | eol = '\n' |
| 4841 | else: |
| 4842 | kwargs['eol'] = eol |
| 4843 | encoded_body = quoprimime.body_encode(body, **kwargs) |
| 4844 | self.assertEqual(encoded_body, expected_encoded_body) |
| 4845 | if eol == '\n' or eol == '\r\n': |
| 4846 | # We know how to split the result back into lines, so maxlinelen |
| 4847 | # can be checked. |
| 4848 | for line in encoded_body.splitlines(): |
| 4849 | self.assertLessEqual(len(line), maxlinelen) |
| 4850 | |
| 4851 | def test_encode_null(self): |
| 4852 | self._test_encode('', '') |
no test coverage detected