From b646757e01d51c242eef2f9802f1ca6836a5804a Mon Sep 17 00:00:00 2001 From: Mark Dickinson Date: Mon, 4 Aug 2008 21:30:09 +0000 Subject: Issue #1481296: (again!) Make conversion of a float NaN to an int or long raise ValueError instead of returning 0. Also, change the error message for conversion of an infinity to an integer, replacing 'long' by 'integer', so that it's appropriate for both long(float('inf')) and int(float('inf')). --- Lib/test/test_long.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'Lib/test/test_long.py') diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index b67c764ad5..e53fd058cf 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -745,7 +745,8 @@ class LongTest(unittest.TestCase): def test_nan_inf(self): self.assertRaises(OverflowError, long, float('inf')) - self.assertEqual(long(float('nan')), 0L) + self.assertRaises(OverflowError, long, float('-inf')) + self.assertRaises(ValueError, long, float('nan')) def test_main(): test_support.run_unittest(LongTest) -- cgit v1.2.1