def test_qp(): # A test for SF bug 534347 (segfaults without the proper fix) try: binascii.a2b_qp("", **{1: 1}) except TypeError: pass else: fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") assert binascii.a2b_qp("= ") == "= " assert binascii.a2b_qp("==") == "=" assert binascii.a2b_qp("=AX") == "=AX" raises(TypeError, binascii.b2a_qp, foo="bar") assert binascii.a2b_qp("=00\r\n=00") == "\x00\r\n\x00" assert binascii.b2a_qp("\xff\r\n\xff\n\xff") == "=FF\r\n=FF\r\n=FF" target = "0" * 75 + "=\r\n=FF\r\n=FF\r\n=FF" assert binascii.b2a_qp("0" * 75 + "\xff\r\n\xff\r\n\xff") == target
def test_qp(): # A test for SF bug 534347 (segfaults without the proper fix) try: binascii.a2b_qp("", **{1:1}) except TypeError: pass else: fail("binascii.a2b_qp(**{1:1}) didn't raise TypeError") assert binascii.a2b_qp("= ") == "= " assert binascii.a2b_qp("==") == "=" assert binascii.a2b_qp("=AX") == "=AX" raises(TypeError, binascii.b2a_qp, foo="bar") assert binascii.a2b_qp("=00\r\n=00") == "\x00\r\n\x00" assert binascii.b2a_qp("\xff\r\n\xff\n\xff") == "=FF\r\n=FF\r\n=FF" target = "0"*75+"=\r\n=FF\r\n=FF\r\n=FF" assert binascii.b2a_qp("0"*75+"\xff\r\n\xff\r\n\xff") == target
def test_qp_bug_case(): assert binascii.b2a_qp('y' * 77, False, False) == 'y' * 75 + '=\nyy' assert binascii.b2a_qp(' ' * 77, False, False) == ' ' * 75 + '=\n =20' assert binascii.b2a_qp('y' * 76, False, False) == 'y' * 76 assert binascii.b2a_qp(' ' * 76, False, False) == ' ' * 75 + '=\n=20'
def test_qp_bug_case(): assert binascii.b2a_qp('y'*77, False, False) == 'y'*75 + '=\nyy' assert binascii.b2a_qp(' '*77, False, False) == ' '*75 + '=\n =20' assert binascii.b2a_qp('y'*76, False, False) == 'y'*76 assert binascii.b2a_qp(' '*76, False, False) == ' '*75 + '=\n=20'