mirror of
https://github.com/python/cpython.git
synced 2025-08-19 00:00:48 +00:00
[3.8] bpo-35168: Make shlex.punctuation_chars read-only (GH-11631) (GH-15927)
(cherry picked from commit 972cf5c06a
)
Co-authored-by: Alex <a.v.shkop@gmail.com>
This commit is contained in:
parent
01ae0e2698
commit
3b92ddb761
4 changed files with 18 additions and 4 deletions
|
@ -353,6 +353,13 @@ class ShlexTest(unittest.TestCase):
|
|||
resplit = shlex.split(joined)
|
||||
self.assertEqual(split_command, resplit)
|
||||
|
||||
def testPunctuationCharsReadOnly(self):
|
||||
punctuation_chars = "/|$%^"
|
||||
shlex_instance = shlex.shlex(punctuation_chars=punctuation_chars)
|
||||
self.assertEqual(shlex_instance.punctuation_chars, punctuation_chars)
|
||||
with self.assertRaises(AttributeError):
|
||||
shlex_instance.punctuation_chars = False
|
||||
|
||||
|
||||
# Allow this test to be used with old shlex.py
|
||||
if not getattr(shlex, "split", None):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue