forked from Rust-related/RustPython
add extra test for check __instancecheck__ work
Signed-off-by: snowapril <sinjihng@gmail.com>
This commit is contained in:
@@ -41,6 +41,13 @@ assert isinstance(AlwaysInstanceOf(), AlwaysInstanceOf)
|
||||
assert isinstance(Regular(), AlwaysInstanceOf)
|
||||
assert isinstance(1, AlwaysInstanceOf)
|
||||
|
||||
class GenericInstance:
|
||||
def __instancecheck__(self, _):
|
||||
return True
|
||||
|
||||
assert isinstance(Regular(), GenericInstance())
|
||||
assert isinstance([], GenericInstance())
|
||||
assert isinstance(1, GenericInstance())
|
||||
|
||||
class MCReturnInt(type):
|
||||
def __instancecheck__(self, instance):
|
||||
|
||||
Reference in New Issue
Block a user