mirror of
https://github.com/RustPython/RustPython.git
synced 2026-10-29 03:04:38 +08:00
bad int test snippet
This commit is contained in:
1 parent
5d50e19432
commit
bb9d09baaf
1 file changed
+7
@@ -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
|
||||
|
||||
Reference in new issue
Block a user