tests/basics: Add test for containment of a subclass of a native type.

This commit is contained in:
Damien George 2017-11-24 14:48:41 +11:00
parent 5e34a113ea
commit 505671b698
1 changed files with 22 additions and 0 deletions

View File

@ -0,0 +1,22 @@
# test containment operator on subclass of a native type
class mylist(list):
pass
class mydict(dict):
pass
class mybytes(bytes):
pass
l = mylist([1, 2, 3])
print(0 in l)
print(1 in l)
d = mydict({1:1, 2:2})
print(0 in l)
print(1 in l)
b = mybytes(b'1234')
print(0 in b)
print(b'1' in b)