-
Notifications
You must be signed in to change notification settings - Fork 167
/
Copy pathtest_pass_compare.py
61 lines (50 loc) · 1.1 KB
/
test_pass_compare.py
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
from lpython import i32
def f():
a11: tuple[i32, i32]
b11: tuple[i32, i32]
a11 = (1, 2)
b11 = (1, 2)
assert a11 == b11
c11: tuple[i32, i32]
c11 = (1, 3)
assert a11 != c11 and c11 != b11
a: tuple[tuple[i32, i32], str, bool]
b: tuple[tuple[i32, i32], str, bool]
a = (a11, 'ok', True)
b = (b11, 'ok', True)
assert a == b
b = (b11, 'notok', True)
assert a != b
def g():
a11: list[i32]
b11: list[i32]
a11 = [1, 2, 3, 4]
b11 = [1, 2, 3, 4]
assert a11 == b11
a11.append(5)
assert a11 != b11
c11: list[i32] = []
assert a11 != c11
d11: list[str] = ['a', 'b', '^', '*']
e11: list[str] = ['a', 'b', '^']
assert d11 != e11
e11.append('*')
assert d11 == e11
f11: list[tuple[i32, i32]] = []
x: tuple[i32, i32]
i: i32
for i in range(10):
x = (i, i+2)
f11.append(x)
g11: list[tuple[i32, i32]] = []
for i in range(9):
x = (i, i+2)
g11.append(x)
assert g11 != f11
x = (9, 11)
g11.append(x)
assert g11 == f11
def check():
f()
g()
check()