Author: Philip Jenvey <[email protected]>
Branch: py3k-stdlib-2.7.6-merge
Changeset: r69881:512fc23baf35
Date: 2014-03-11 19:45 -0700
http://bitbucket.org/pypy/pypy/changeset/512fc23baf35/
Log: merge default
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
@@ -110,7 +110,7 @@
assert charmap_decode(b'xxx\xff', 'strict', map) == ('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')}) ==
@@ -671,11 +671,11 @@
assert 'xxx'.encode('charmap') == b'xxx'
import codecs
- exc = raises(TypeError, codecs.charmap_encode, '\xff', "replace",
{0xff: 300})
- assert exc.value[0] == 'character mapping must be in range(256)'
- exc = raises(TypeError, codecs.charmap_encode, '\xff', "replace",
{0xff: u'a'})
- assert exc.value[0] == 'character mapping must return integer, None or
str'
- raises(UnicodeError, codecs.charmap_encode, "\xff", "replace", {0xff:
None})
+ exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace",
{0xff: 300})
+ assert str(exc.value) == 'character mapping must be in range(256)'
+ exc = raises(TypeError, codecs.charmap_encode, u'\xff', "replace",
{0xff: u'a'})
+ 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):
charmap = dict([(c, bytes([c, c]).upper()) for c in b"abcdefgh"])
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