summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_shlex.py
diff options
context:
space:
mode:
authorAlex <a.v.shkop@gmail.com>2019-09-11 11:04:04 (GMT)
committerVinay Sajip <vinay_sajip@yahoo.co.uk>2019-09-11 11:04:04 (GMT)
commit972cf5c06a5ba16ad243a442dbb9c15307fbed95 (patch)
treedd46b382dca4d0ad097442ba910e24f84b0755dd /Lib/test/test_shlex.py
parent6a9fd66f6e4445a418c43c92585b9e06d76df4b1 (diff)
downloadcpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.zip
cpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.tar.gz
cpython-972cf5c06a5ba16ad243a442dbb9c15307fbed95.tar.bz2
bpo-35168: Make shlex.punctuation_chars read-only (#11631)
* bpo-35168: Documentation about shlex.punctuation_chars now states that it should be set in __init__.py * bpo-35168: Convert shlex.punctuation_chars to read-only property * Add NEWS.d entry
Diffstat (limited to 'Lib/test/test_shlex.py')
-rw-r--r--Lib/test/test_shlex.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/Lib/test/test_shlex.py b/Lib/test/test_shlex.py
index 376c5e8..a21ccd2 100644
--- a/Lib/test/test_shlex.py
+++ b/Lib/test/test_shlex.py
@@ -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):