Author: Brian Kearns <[email protected]>
Branch:
Changeset: r69879:1e5259694b26
Date: 2014-03-11 20:51 -0400
http://bitbucket.org/pypy/pypy/changeset/1e5259694b26/
Log: py3k compat
diff --git a/pypy/module/__builtin__/test/test_builtin.py
b/pypy/module/__builtin__/test/test_builtin.py
--- a/pypy/module/__builtin__/test/test_builtin.py
+++ b/pypy/module/__builtin__/test/test_builtin.py
@@ -496,7 +496,7 @@
assert 'fake' in str(exc.value)
exc = raises(SyntaxError, compile,
b'\xef\xbb\xbf# -*- coding: iso-8859-15 -*-\n', 'dummy', 'exec')
- assert 'iso-8859-15' in str(exc.value), str(exc.value)
+ assert 'iso-8859-15' in str(exc.value)
assert 'BOM' in str(exc.value)
exc = raises(SyntaxError, compile,
b'\xef\xbb\xbf# -*- coding: fake -*-\n', 'dummy', 'exec')
diff --git a/pypy/module/_codecs/test/test_codecs.py
b/pypy/module/_codecs/test/test_codecs.py
--- a/pypy/module/_codecs/test/test_codecs.py
+++ b/pypy/module/_codecs/test/test_codecs.py
@@ -109,7 +109,7 @@
assert charmap_decode('xxx\xff', 'strict', map) == (u'xxx\xff', 4)
exc = raises(TypeError, charmap_decode, '\xff', "strict", {0xff: 'a'})
- assert exc.value[0] == "character mapping must return integer, None or
unicode"
+ assert str(exc.value) == "character mapping must return integer, None
or unicode"
raises(TypeError, charmap_decode, '\xff', "strict", {0xff: 0x110000})
assert (charmap_decode("\x00\x01\x02", "strict",
{0: 0x10FFFF, 1: ord('b'), 2: ord('c')}) ==
@@ -615,9 +615,9 @@
import codecs
exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace",
{0xff: 300})
- assert exc.value[0] == 'character mapping must be in range(256)'
+ assert str(exc.value) == 'character mapping must be in range(256)'
exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace",
{0xff: u'a'})
- assert exc.value[0] == 'character mapping must return integer, None or
str'
+ assert str(exc.value) == 'character mapping must return integer, None
or str'
raises(UnicodeError, codecs.charmap_encode, u"\xff", "replace", {0xff:
None})
def test_charmap_encode_replace(self):
diff --git a/pypy/module/pwd/test/test_pwd.py b/pypy/module/pwd/test/test_pwd.py
--- a/pypy/module/pwd/test/test_pwd.py
+++ b/pypy/module/pwd/test/test_pwd.py
@@ -27,18 +27,18 @@
raises(KeyError, pwd.getpwuid, sys.maxsize)
# -1 is allowed, cast to uid_t
exc = raises(KeyError, pwd.getpwuid, -1)
- m = re.match('getpwuid\(\): uid not found: ([0-9]+)', exc.value[0])
- assert m, exc.value[0]
+ m = re.match('getpwuid\(\): uid not found: ([0-9]+)',
exc.value.args[0])
+ assert m, exc.value.args[0]
maxval = int(m.group(1))
assert maxval >= 2**32 - 1
# shouldn't overflow
exc = raises(KeyError, pwd.getpwuid, maxval)
- m = re.match('getpwuid\(\): uid not found: ([0-9]+)', exc.value[0])
- assert m, exc.value[0]
+ m = re.match('getpwuid\(\): uid not found: ([0-9]+)',
exc.value.args[0])
+ assert m, exc.value.args[0]
# should be out of uid_t range
for v in [-2, maxval+1, 2**128, -2**128]:
exc = raises(KeyError, pwd.getpwuid, v)
- assert exc.value[0] == 'getpwuid(): uid not found'
+ assert exc.value.args[0] == 'getpwuid(): uid not found'
def test_getpwnam(self):
import pwd
_______________________________________________
pypy-commit mailing list
[email protected]
https://mail.python.org/mailman/listinfo/pypy-commit