mirror of
https://github.com/python/cpython.git
synced 2026-02-06 09:50:43 +00:00
[3.14] gh-144027: Fix documentation for ignorechars in base64.a85decode() (GH-144028) (GH-144192)
It does not support an ASCII string.
Also add more tests.
(cherry picked from commit 25a10b60b0)
Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
This commit is contained in:
parent
05356b1cc1
commit
1947d6ea56
2 changed files with 14 additions and 2 deletions
|
|
@ -239,8 +239,7 @@ Refer to the documentation of the individual functions for more information.
|
|||
*adobe* controls whether the input sequence is in Adobe Ascii85 format
|
||||
(i.e. is framed with <~ and ~>).
|
||||
|
||||
*ignorechars* should be a :term:`bytes-like object` or ASCII string
|
||||
containing characters to ignore
|
||||
*ignorechars* should be a byte string containing characters to ignore
|
||||
from the input. This should only contain whitespace characters, and by
|
||||
default contains all whitespace characters in ASCII.
|
||||
|
||||
|
|
|
|||
|
|
@ -785,6 +785,19 @@ def test_a85decode_errors(self):
|
|||
self.assertRaises(ValueError, base64.a85decode, b'aaaay',
|
||||
foldspaces=True)
|
||||
|
||||
self.assertEqual(base64.a85decode(b"a b\nc", ignorechars=b" \n"),
|
||||
b'\xc9\x89')
|
||||
with self.assertRaises(ValueError):
|
||||
base64.a85decode(b"a b\nc", ignorechars=b"")
|
||||
with self.assertRaises(ValueError):
|
||||
base64.a85decode(b"a b\nc", ignorechars=b" ")
|
||||
with self.assertRaises(ValueError):
|
||||
base64.a85decode(b"a b\nc", ignorechars=b"\n")
|
||||
with self.assertRaises(TypeError):
|
||||
base64.a85decode(b"a b\nc", ignorechars=" \n")
|
||||
with self.assertRaises(TypeError):
|
||||
base64.a85decode(b"a b\nc", ignorechars=None)
|
||||
|
||||
def test_b85decode_errors(self):
|
||||
illegal = list(range(33)) + \
|
||||
list(b'"\',./:[\\]') + \
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue