diff options
author | Mark Dickinson <dickinsm@gmail.com> | 2009-09-08 19:23:44 (GMT) |
---|---|---|
committer | Mark Dickinson <dickinsm@gmail.com> | 2009-09-08 19:23:44 (GMT) |
commit | 8fde3da126674a9c5c529da8e4d9d7094030739e (patch) | |
tree | b047382092f2bc8397a75ad7d4ce2e80fdc61870 /Lib/test/test_decimal.py | |
parent | 0e8b8877db1f11357dd28441ae542866a0d192e3 (diff) | |
download | cpython-8fde3da126674a9c5c529da8e4d9d7094030739e.zip cpython-8fde3da126674a9c5c529da8e4d9d7094030739e.tar.gz cpython-8fde3da126674a9c5c529da8e4d9d7094030739e.tar.bz2 |
Merged revisions 74709 via svnmerge from
svn+ssh://pythondev@www.python.org/python/branches/py3k
................
r74709 | mark.dickinson | 2009-09-07 19:08:12 +0100 (Mon, 07 Sep 2009) | 9 lines
Merged revisions 74708 via svnmerge from
svn+ssh://pythondev@svn.python.org/python/trunk
........
r74708 | mark.dickinson | 2009-09-07 19:04:58 +0100 (Mon, 07 Sep 2009) | 2 lines
#Issue 6795: Fix infinite recursion in long(Decimal('nan')); change int(Decimal('nan')) to raise ValueError instead of either returning NaN or raising InvalidContext.
........
................
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index f0c4431..e3e50f0 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1543,6 +1543,11 @@ class DecimalPythonAPItests(unittest.TestCase): r = d.to_integral(ROUND_DOWN) self.assertEqual(Decimal(int(d)), r) + self.assertRaises(ValueError, int, Decimal('-nan')) + self.assertRaises(ValueError, int, Decimal('snan')) + self.assertRaises(OverflowError, int, Decimal('inf')) + self.assertRaises(OverflowError, int, Decimal('-inf')) + def test_trunc(self): for x in range(-250, 250): s = '%0.2f' % (x / 100.0) |