summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_getargs2.py
diff options
context:
space:
mode:
authorVictor Stinner <victor.stinner@haypocalc.com>2010-06-25 00:02:38 (GMT)
committerVictor Stinner <victor.stinner@haypocalc.com>2010-06-25 00:02:38 (GMT)
commit25e8ec47244b405083b5fe7b353560666cabff44 (patch)
tree2412de21beab51e376834501ddf8beb866b40df9 /Lib/test/test_getargs2.py
parent21e09487ac9d4365819ae4de31319ae3df9a8b17 (diff)
downloadcpython-25e8ec47244b405083b5fe7b353560666cabff44.zip
cpython-25e8ec47244b405083b5fe7b353560666cabff44.tar.gz
cpython-25e8ec47244b405083b5fe7b353560666cabff44.tar.bz2
Issue #8850: Remove "w" and "w#" formats from PyArg_Parse*() functions, use
"w*" format instead. Add tests for "w*" format.
Diffstat (limited to 'Lib/test/test_getargs2.py')
-rw-r--r--Lib/test/test_getargs2.py10
1 files changed, 10 insertions, 0 deletions
diff --git a/Lib/test/test_getargs2.py b/Lib/test/test_getargs2.py
index 5ade2b4..d751c1a 100644
--- a/Lib/test/test_getargs2.py
+++ b/Lib/test/test_getargs2.py
@@ -375,6 +375,16 @@ class Bytes_TestCase(unittest.TestCase):
self.assertRaises(TypeError, getargs_y_hash, memoryview(b'memoryview'))
self.assertRaises(TypeError, getargs_y_hash, None)
+ def test_w_star(self):
+ # getargs_w_star() modifies first and last byte
+ from _testcapi import getargs_w_star
+ self.assertRaises(TypeError, getargs_w_star, 'abc\xe9')
+ self.assertRaises(TypeError, getargs_w_star, b'bytes')
+ self.assertRaises(TypeError, getargs_w_star, b'nul:\0')
+ self.assertEqual(getargs_w_star(bytearray(b'bytearray')), b'[ytearra]')
+ self.assertEqual(getargs_w_star(memoryview(b'memoryview')), b'[emoryvie]')
+ self.assertRaises(TypeError, getargs_w_star, None)
+
class Unicode_TestCase(unittest.TestCase):
def test_u(self):