-
-
Notifications
You must be signed in to change notification settings - Fork 33.7k
Closed as not planned
Labels
testsTests in the Lib/test dirTests in the Lib/test dir
Description
The hypothesis test test_b2a_qp_a2b_qp_round_trip checks that binascii.a2b_qp(binascii.b2a_qp(<value>)) gives the original value. However, this is not always true when istext=True (the default) and the value contains a mix of \n and \r\n new lines.
import binascii
>>>binascii.b2a_qp(b'\n\r\n', istext=True)
b'\n\n'
>>> binascii.a2b_qp(b'\n\n')
b'\n\n'cpython/Lib/test/test_binascii.py
Lines 413 to 426 in 36c6178
| @hypothesis.given( | |
| binary=hypothesis.strategies.binary(), | |
| quotetabs=hypothesis.strategies.booleans(), | |
| istext=hypothesis.strategies.booleans(), | |
| header=hypothesis.strategies.booleans(), | |
| ) | |
| def test_b2a_qp_a2b_qp_round_trip(self, binary, quotetabs, istext, header): | |
| converted = binascii.b2a_qp( | |
| self.type2test(binary), | |
| quotetabs=quotetabs, istext=istext, header=header, | |
| ) | |
| restored = binascii.a2b_qp(self.type2test(converted), header=header) | |
| self.assertConversion(binary, converted, restored, | |
| quotetabs=quotetabs, istext=istext, header=header) |
See also #64320
Seen in https://github.com/python/cpython/actions/runs/12200589926/job/34037087571
Metadata
Metadata
Assignees
Labels
testsTests in the Lib/test dirTests in the Lib/test dir