diff options
author | Mark Dickinson <mdickinson@enthought.com> | 2011-05-22 11:53:18 (GMT) |
---|---|---|
committer | Mark Dickinson <mdickinson@enthought.com> | 2011-05-22 11:53:18 (GMT) |
commit | b455e58b95a6603f8464f6de4474c160a8f83047 (patch) | |
tree | c71a40a0a4815f88ef2001782dadc67f5c0505ac /Lib/test/test_decimal.py | |
parent | 203bdb3028574fb45caae44bbb9275d9a6aa2795 (diff) | |
download | cpython-b455e58b95a6603f8464f6de4474c160a8f83047.zip cpython-b455e58b95a6603f8464f6de4474c160a8f83047.tar.gz cpython-b455e58b95a6603f8464f6de4474c160a8f83047.tar.bz2 |
Issue #12079: Decimal(0).fma(Decimal('inf'), 'not a number') should give a TypeError, not a Decimal.InvalidOperation
Diffstat (limited to 'Lib/test/test_decimal.py')
-rw-r--r-- | Lib/test/test_decimal.py | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/Lib/test/test_decimal.py b/Lib/test/test_decimal.py index e46cd91..96bbafe 100644 --- a/Lib/test/test_decimal.py +++ b/Lib/test/test_decimal.py @@ -1970,6 +1970,17 @@ class ContextAPItests(unittest.TestCase): self.assertRaises(TypeError, c.fma, 2, '3', 4) self.assertRaises(TypeError, c.fma, 2, 3, '4') + # Issue 12079 for Context.fma ... + self.assertRaises(TypeError, c.fma, + Decimal('Infinity'), Decimal(0), "not a decimal") + self.assertRaises(TypeError, c.fma, + Decimal(1), Decimal('snan'), 1.222) + # ... and for Decimal.fma. + self.assertRaises(TypeError, Decimal('Infinity').fma, + Decimal(0), "not a decimal") + self.assertRaises(TypeError, Decimal(1).fma, + Decimal('snan'), 1.222) + def test_is_finite(self): c = Context() d = c.is_finite(Decimal(10)) |