[Jython-checkins] jython: Fix max such that any raised ValueError uses the correct error message text.
jim.baker
jython-checkins at python.org
Sat Jul 26 11:03:31 CEST 2014
http://hg.python.org/jython/rev/8f4fef31df0b
changeset: 7350:8f4fef31df0b
user: Henning Jacobs <henning at jacobs1.de>
date: Sat Jul 26 10:51:23 2014 +0200
summary:
Fix max such that any raised ValueError uses the correct error message text.
Fixes http://bugs.jython.org/issue2130
files:
ACKNOWLEDGMENTS | 1 +
Lib/test/test_builtin_jy.py | 9 +++++++++
src/org/python/core/__builtin__.java | 2 +-
3 files changed, 11 insertions(+), 1 deletions(-)
diff --git a/ACKNOWLEDGMENTS b/ACKNOWLEDGMENTS
--- a/ACKNOWLEDGMENTS
+++ b/ACKNOWLEDGMENTS
@@ -111,6 +111,7 @@
Timothée Lecomte
Peter Holloway
Werner Mendizabal
+ Henning Jacobs
Local Variables:
mode: indented-text
diff --git a/Lib/test/test_builtin_jy.py b/Lib/test/test_builtin_jy.py
--- a/Lib/test/test_builtin_jy.py
+++ b/Lib/test/test_builtin_jy.py
@@ -42,6 +42,15 @@
self.assertTrue(numeric < Ellipsis)
self.assertTrue(Ellipsis > numeric)
+ def test_max_error_message(self):
+ 'fix for http://bugs.jython.org/issue2130'
+ try:
+ max([])
+ except ValueError, e:
+ self.assertEqual(str(e), 'max of empty sequence')
+ else:
+ self.fail('max with empty sequence should raise a proper ValueError')
+
class LoopTest(unittest.TestCase):
def test_break(self):
diff --git a/src/org/python/core/__builtin__.java b/src/org/python/core/__builtin__.java
--- a/src/org/python/core/__builtin__.java
+++ b/src/org/python/core/__builtin__.java
@@ -1526,7 +1526,7 @@
}
}
if (max == null) {
- throw Py.ValueError("min of empty sequence");
+ throw Py.ValueError("max of empty sequence");
}
return max;
}
--
Repository URL: http://hg.python.org/jython
More information about the Jython-checkins
mailing list