[pypy-svn] pypy bytearray: (lac, mfoord) test constructing a bytearray of size -1 fails with a ValueError

mfoord commits-noreply at bitbucket.org
Thu Jan 20 18:51:46 CET 2011


Author: Michael Foord <michael at voidspace.org.uk>
Branch: bytearray
Changeset: r41060:2b2b6bfa0552
Date: 2011-01-20 18:49 +0100
http://bitbucket.org/pypy/pypy/changeset/2b2b6bfa0552/

Log:	(lac, mfoord) test constructing a bytearray of size -1 fails with a
	ValueError

diff --git a/pypy/objspace/std/bytearrayobject.py b/pypy/objspace/std/bytearrayobject.py
--- a/pypy/objspace/std/bytearrayobject.py
+++ b/pypy/objspace/std/bytearrayobject.py
@@ -167,7 +167,6 @@
             return space.w_False
     return space.w_True
 
-
 def String2Bytearray(space, w_str):
     data = [c for c in space.str_w(w_str)]
     return W_BytearrayObject(data)

diff --git a/pypy/objspace/std/test/test_bytes.py b/pypy/objspace/std/test/test_bytes.py
--- a/pypy/objspace/std/test/test_bytes.py
+++ b/pypy/objspace/std/test/test_bytes.py
@@ -14,6 +14,7 @@
         raises(ValueError, bytearray, ['a', 'bc'])
         raises(ValueError, bytearray, [65, -3])
         raises(TypeError, bytearray, [65.0])
+        raises(ValueError, bytearray, -1)
 
     def test_init_override(self):
         class subclass(bytearray):


More information about the Pypy-commit mailing list