summaryrefslogtreecommitdiffstats
path: root/Lib/test/test_int.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/test/test_int.py')
-rw-r--r--Lib/test/test_int.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/test/test_int.py b/Lib/test/test_int.py
index 437e323..227759f 100644
--- a/Lib/test/test_int.py
+++ b/Lib/test/test_int.py
@@ -305,6 +305,18 @@ class IntTestCases(unittest.TestCase):
self.fail("Failed to raise TypeError with %s" %
((base, trunc_result_base),))
+ # Regression test for bugs.python.org/issue16060.
+ class BadInt(trunc_result_base):
+ def __int__(self):
+ return 42.0
+
+ class TruncReturnsBadInt(base):
+ def __trunc__(self):
+ return BadInt()
+
+ with self.assertRaises(TypeError):
+ int(TruncReturnsBadInt())
+
def test_error_message(self):
testlist = ('\xbd', '123\xbd', ' 123 456 ')
for s in testlist: