summaryrefslogtreecommitdiffstats
path: root/Lib
diff options
context:
space:
mode:
authorMartin Panter <vadmium+py@gmail.com>2016-09-07 23:31:39 (GMT)
committerMartin Panter <vadmium+py@gmail.com>2016-09-07 23:31:39 (GMT)
commit1c748f383033df1126f2f79f051eee440ba08449 (patch)
treedcb41f4507ff7d705cee8e6e8568da2798fa9807 /Lib
parentf3b5bcafcb75a2e350aa447ec7ad3d77a3eaee80 (diff)
parentbe8da9c9906571698fe218da9e218ece500d5239 (diff)
downloadcpython-1c748f383033df1126f2f79f051eee440ba08449.zip
cpython-1c748f383033df1126f2f79f051eee440ba08449.tar.gz
cpython-1c748f383033df1126f2f79f051eee440ba08449.tar.bz2
Issue #27570: Merge null pointer fixes from 3.5
Diffstat (limited to 'Lib')
-rw-r--r--Lib/test/test_array.py14
1 files changed, 12 insertions, 2 deletions
diff --git a/Lib/test/test_array.py b/Lib/test/test_array.py
index 8fd54cc..1f8967c 100644
--- a/Lib/test/test_array.py
+++ b/Lib/test/test_array.py
@@ -36,14 +36,24 @@ typecodes = "ubBhHiIlLfd"
if have_long_long:
typecodes += 'qQ'
-class BadConstructorTest(unittest.TestCase):
+class MiscTest(unittest.TestCase):
- def test_constructor(self):
+ def test_bad_constructor(self):
self.assertRaises(TypeError, array.array)
self.assertRaises(TypeError, array.array, spam=42)
self.assertRaises(TypeError, array.array, 'xx')
self.assertRaises(ValueError, array.array, 'x')
+ def test_empty(self):
+ # Exercise code for handling zero-length arrays
+ a = array.array('B')
+ a[:] = a
+ self.assertEqual(len(a), 0)
+ self.assertEqual(len(a + a), 0)
+ self.assertEqual(len(a * 3), 0)
+ a += a
+ self.assertEqual(len(a), 0)
+
# Machine format codes.
#