[pypy-commit] pypy py3k: add a test to check the point of the whole refactoring, i.e. that non-ASCII chars are preserved in the exception message
antocuni
noreply at buildbot.pypy.org
Wed Jul 18 16:19:06 CEST 2012
Author: Antonio Cuni <anto.cuni at gmail.com>
Branch: py3k
Changeset: r56163:f4b7f14eeb63
Date: 2012-07-18 16:18 +0200
http://bitbucket.org/pypy/pypy/changeset/f4b7f14eeb63/
Log: add a test to check the point of the whole refactoring, i.e. that
non-ASCII chars are preserved in the exception message
diff --git a/pypy/objspace/std/strutil.py b/pypy/objspace/std/strutil.py
--- a/pypy/objspace/std/strutil.py
+++ b/pypy/objspace/std/strutil.py
@@ -37,6 +37,7 @@
class NumberStringParser:
def error(self):
+ import pdb;pdb.set_trace()
raise ParseStringError(u"invalid literal for %s() with base %d: '%s'" %
(self.fname, self.original_base, self.literal))
diff --git a/pypy/objspace/std/test/test_longobject.py b/pypy/objspace/std/test/test_longobject.py
--- a/pypy/objspace/std/test/test_longobject.py
+++ b/pypy/objspace/std/test/test_longobject.py
@@ -323,3 +323,11 @@
def test_long_from_unicode(self):
s = '\U0001D7CF\U0001D7CE' # 𝟏𝟎
assert int(s) == 10
+
+ def test_invalid_literal_message(self):
+ try:
+ int('hello àèìò')
+ except ValueError as e:
+ assert 'hello àèìò' in e.message
+ else:
+ assert False, 'did not raise'
More information about the pypy-commit
mailing list