diff options
author | Zackery Spytz <zspytz@gmail.com> | 2022-02-03 09:43:25 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-03 09:43:25 (GMT) |
commit | b4bd1e1422997de61faf506b4916e83013bc7d21 (patch) | |
tree | a6c3e97b10f04c4ca17f876c5c9cfa061d287a34 /Lib/test/test_long.py | |
parent | 7ffe7ba30fc051014977c6f393c51e57e71a6648 (diff) | |
download | cpython-b4bd1e1422997de61faf506b4916e83013bc7d21.zip cpython-b4bd1e1422997de61faf506b4916e83013bc7d21.tar.gz cpython-b4bd1e1422997de61faf506b4916e83013bc7d21.tar.bz2 |
bpo-44977: Deprecate delegation of int to __trunc__ (GH-31031)
Calling int(a) when type(a) implements __trunc__ but not __int__
or __index__ now raises a DeprecationWarning.
Diffstat (limited to 'Lib/test/test_long.py')
-rw-r--r-- | Lib/test/test_long.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/test/test_long.py b/Lib/test/test_long.py index c7dd0b2..e68dfb4 100644 --- a/Lib/test/test_long.py +++ b/Lib/test/test_long.py @@ -392,7 +392,8 @@ class LongTest(unittest.TestCase): return 42 def __trunc__(self): return 1729 - self.assertEqual(int(LongTrunc()), 1729) + with self.assertWarns(DeprecationWarning): + self.assertEqual(int(LongTrunc()), 1729) def check_float_conversion(self, n): # Check that int -> float conversion behaviour matches |