summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_math.py
diff options
context:
space:
mode:
authorSerhiy Storchaka <storchaka@gmail.com>2020-05-26 15:43:38 (GMT)
committerGitHub <noreply@github.com>2020-05-26 15:43:38 (GMT)
commit578c3955e0222ec7b3146197467fbb0fcfae12fe (patch)
tree1314ca1eb6153feaf3fb1cae341784270ce24c32 /Lib/test/test_math.py
parent8ad052464a4e0aef9a11663b80f187087b773592 (diff)
downloadcpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.zip
cpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.tar.gz
cpython-578c3955e0222ec7b3146197467fbb0fcfae12fe.tar.bz2
bpo-37999: No longer use __int__ in implicit integer conversions. (GH-15636)
Only __index__ should be used to make integer conversions lossless.
Diffstat (limited to 'Lib/test/test_math.py')
-rw-r--r--Lib/test/test_math.py15
1 files changed, 5 insertions, 10 deletions
diff --git a/Lib/test/test_math.py b/Lib/test/test_math.py
index 4b848a5..e06b1e6 100644
--- a/Lib/test/test_math.py
+++ b/Lib/test/test_math.py
@@ -502,14 +502,10 @@ class MathTests(unittest.TestCase):
self.assertRaises(ValueError, math.factorial, -10**100)
def testFactorialNonIntegers(self):
- with self.assertWarns(DeprecationWarning):
- self.assertEqual(math.factorial(5.0), 120)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(ValueError, math.factorial, 5.2)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(ValueError, math.factorial, -1.0)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(ValueError, math.factorial, -1e100)
+ self.assertRaises(TypeError, math.factorial, 5.0)
+ self.assertRaises(TypeError, math.factorial, 5.2)
+ self.assertRaises(TypeError, math.factorial, -1.0)
+ self.assertRaises(TypeError, math.factorial, -1e100)
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5'))
self.assertRaises(TypeError, math.factorial, decimal.Decimal('5.2'))
self.assertRaises(TypeError, math.factorial, "5")
@@ -520,8 +516,7 @@ class MathTests(unittest.TestCase):
# Currently raises OverflowError for inputs that are too large
# to fit into a C long.
self.assertRaises(OverflowError, math.factorial, 10**100)
- with self.assertWarns(DeprecationWarning):
- self.assertRaises(OverflowError, math.factorial, 1e100)
+ self.assertRaises(TypeError, math.factorial, 1e100)
def testFloor(self):
self.assertRaises(TypeError, math.floor)