Skip to content

Commit 505671b

Browse files
committed
tests/basics: Add test for containment of a subclass of a native type.
1 parent 5e34a11 commit 505671b

1 file changed

Lines changed: 22 additions & 0 deletions

File tree

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# test containment operator on subclass of a native type
2+
3+
class mylist(list):
4+
pass
5+
6+
class mydict(dict):
7+
pass
8+
9+
class mybytes(bytes):
10+
pass
11+
12+
l = mylist([1, 2, 3])
13+
print(0 in l)
14+
print(1 in l)
15+
16+
d = mydict({1:1, 2:2})
17+
print(0 in l)
18+
print(1 in l)
19+
20+
b = mybytes(b'1234')
21+
print(0 in b)
22+
print(b'1' in b)

0 commit comments

Comments
 (0)