-
Notifications
You must be signed in to change notification settings - Fork 94
Expand file tree
/
Copy pathtest_isinstance.html
More file actions
62 lines (46 loc) · 895 Bytes
/
test_isinstance.html
File metadata and controls
62 lines (46 loc) · 895 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<html>
<head>
<script src="pythonscript.js"></script>
</head>
<body>
<script type="text/python" closure="false">
class X:
pass
class Y( X ):
pass
def test():
a = []
if isinstance( a, list):
print 'list OK'
b = {}
if isinstance( b, dict ):
print 'dict OK'
c = (1,2)
if isinstance( c, tuple ):
print 'tuple OK'
x = X()
y = Y()
if isinstance(x,X):
print 'class X OK'
if isinstance(y,Y):
print 'class Y OK'
if isinstance(y,X):
print 'class Y subclass OK'
print 'testing with javascript:'
with javascript:
if isinstance( a, list):
print 'list OK'
if isinstance( b, dict ):
print 'dict OK'
if isinstance( c, tuple ):
print 'tuple OK'
if isinstance(x,X):
print 'class X OK'
if isinstance(y,Y):
print 'class Y OK'
if isinstance(y,X):
print 'class Y subclass OK'
</script>
<button onclick="test()">click me</button>
</body>
</html>