# HG changeset patch # User Henning Jacobs # Date 1406363305 -7200 # Sat Jul 26 10:28:25 2014 +0200 # Node ID f60284af81dc28e70458a7bfe8c99ddf161c78a8 # Parent 687a7f537cdd81f7e0e5daf1120bd5048c8ca748 test to reproduce http://bugs.jython.org/issue2130 diff -r 687a7f537cdd -r f60284af81dc Lib/test/test_builtin_jy.py --- a/Lib/test/test_builtin_jy.py Sat Jul 26 10:19:01 2014 +0200 +++ b/Lib/test/test_builtin_jy.py Sat Jul 26 10:28:25 2014 +0200 @@ -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): # HG changeset patch # User Henning Jacobs # Date 1406363802 -7200 # Sat Jul 26 10:36:42 2014 +0200 # Node ID 72c9e57940d5e1a9e5b9643acfc433229e17d7f9 # Parent f60284af81dc28e70458a7bfe8c99ddf161c78a8 fix for http://bugs.jython.org/issue2130 (wrong exception message for max([])) diff -r f60284af81dc -r 72c9e57940d5 src/org/python/core/__builtin__.java --- a/src/org/python/core/__builtin__.java Sat Jul 26 10:28:25 2014 +0200 +++ b/src/org/python/core/__builtin__.java Sat Jul 26 10:36:42 2014 +0200 @@ -1526,7 +1526,7 @@ } } if (max == null) { - throw Py.ValueError("min of empty sequence"); + throw Py.ValueError("max of empty sequence"); } return max; }