[pypy-commit] pypy py3k: 2to3ish

pjenvey noreply at buildbot.pypy.org
Thu Dec 19 04:31:24 CET 2013


Author: Philip Jenvey <pjenvey at underboss.org>
Branch: py3k
Changeset: r68482:231446df54bb
Date: 2013-12-18 19:30 -0800
http://bitbucket.org/pypy/pypy/changeset/231446df54bb/

Log:	2to3ish

diff --git a/pypy/module/micronumpy/test/test_scalar.py b/pypy/module/micronumpy/test/test_scalar.py
--- a/pypy/module/micronumpy/test/test_scalar.py
+++ b/pypy/module/micronumpy/test/test_scalar.py
@@ -22,10 +22,10 @@
         import numpy as np
         assert int(np.str_('12')) == 12
         exc = raises(ValueError, "int(np.str_('abc'))")
-        assert exc.value.message.startswith('invalid literal for int()')
-        assert oct(np.int32(11)) == '013'
-        assert oct(np.float32(11.6)) == '013'
-        assert oct(np.complex64(11-12j)) == '013'
+        assert str(exc.value).startswith('invalid literal for int()')
+        assert oct(np.int32(11)) == '0o13'
+        assert oct(np.float32(11.6)) == '0o13'
+        assert oct(np.complex64(11-12j)) == '0o13'
         assert hex(np.int32(11)) == '0xb'
         assert hex(np.float32(11.6)) == '0xb'
         assert hex(np.complex64(11-12j)) == '0xb'
@@ -43,7 +43,7 @@
         except ImportError:
             # running on dummy module
             from numpy import scalar
-        from cPickle import loads, dumps
+        from pickle import loads, dumps
         i = dtype('int32').type(1337)
         f = dtype('float64').type(13.37)
         c = dtype('complex128').type(13 + 37.j)
@@ -98,10 +98,10 @@
     def test_buffer(self):
         import numpy as np
         a = np.int32(123)
-        b = buffer(a)
-        assert type(b) is buffer
+        b = memoryview(a)
+        assert type(b) is memoryview
         a = np.string_('abc')
-        b = buffer(a)
+        b = memoryview(a)
         assert str(b) == a
 
     def test_squeeze(self):
@@ -137,7 +137,7 @@
         import sys
         s = np.dtype('int64').type(12)
         exc = raises(ValueError, s.view, 'int8')
-        assert exc.value[0] == "new type not compatible with array."
+        assert str(exc.value) == "new type not compatible with array."
         t = s.view('double')
         assert type(t) is np.double
         assert t < 7e-323
@@ -146,7 +146,7 @@
         assert 0 < t.real < 1
         assert t.imag == 0
         exc = raises(TypeError, s.view, 'string')
-        assert exc.value[0] == "data-type must not be 0-sized"
+        assert str(exc.value) == "data-type must not be 0-sized"
         t = s.view('S8')
         assert type(t) is np.string_
         assert t == '\x0c'


More information about the pypy-commit mailing list