From bb9d09baaf3d0686a0fedf443fb20da1b46a4340 Mon Sep 17 00:00:00 2001 From: Jeong YunWon Date: Wed, 8 Jan 2020 11:53:00 +0900 Subject: [PATCH] bad int test snippet --- tests/snippets/ints.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tests/snippets/ints.py b/tests/snippets/ints.py index bffdc103d..6f42c9489 100644 --- a/tests/snippets/ints.py +++ b/tests/snippets/ints.py @@ -273,6 +273,13 @@ class F(float): assert int(F(1.2)) == 3 +class BadInt(int): + def __int__(self): + return 42.0 + +with assert_raises(TypeError): + int(BadInt()) + assert isinstance((0).__round__(), int) assert isinstance((1).__round__(), int) assert (0).__round__() == 0