mirror of
https://github.com/python/cpython.git
synced 2025-08-30 21:48:47 +00:00
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. ........
This commit is contained in:
parent
7718d2bfb0
commit
825fce34b1
3 changed files with 11 additions and 3 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue