diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2019-02-25 15:57:58 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-02-25 15:57:58 (GMT) |
commit | 6a44f6eef3d0958d88882347190b3e2d1222c2e9 (patch) | |
tree | bb6474b1e094a672837c3333a081fa4d5d7638f2 /Lib/test/datetimetester.py | |
parent | d90a141bb947b68601f8d1f37bc98f7b524f0e01 (diff) | |
download | cpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.zip cpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.tar.gz cpython-6a44f6eef3d0958d88882347190b3e2d1222c2e9.tar.bz2 |
bpo-36048: Use __index__() instead of __int__() for implicit conversion if available. (GH-11952)
Deprecate using the __int__() method in implicit conversions of Python
numbers to C integers.
Diffstat (limited to 'Lib/test/datetimetester.py')
-rw-r--r-- | Lib/test/datetimetester.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/test/datetimetester.py b/Lib/test/datetimetester.py index 958b336..715f0ea 100644 --- a/Lib/test/datetimetester.py +++ b/Lib/test/datetimetester.py @@ -4918,8 +4918,9 @@ class Oddballs(unittest.TestCase): for xx in [decimal.Decimal(10), decimal.Decimal('10.9'), Number(10)]: - self.assertEqual(datetime(10, 10, 10, 10, 10, 10, 10), - datetime(xx, xx, xx, xx, xx, xx, xx)) + with self.assertWarns(DeprecationWarning): + self.assertEqual(datetime(10, 10, 10, 10, 10, 10, 10), + datetime(xx, xx, xx, xx, xx, xx, xx)) with self.assertRaisesRegex(TypeError, '^an integer is required ' r'\(got type str\)$'): @@ -4927,7 +4928,7 @@ class Oddballs(unittest.TestCase): f10 = Number(10.9) with self.assertRaisesRegex(TypeError, '^__int__ returned non-int ' - r'\(type float\)$'): + r'\(type float\)$'): datetime(10, 10, f10) class Float(float): |