File tree Expand file tree Collapse file tree 3 files changed +97
-1
lines changed Expand file tree Collapse file tree 3 files changed +97
-1
lines changed Original file line number Diff line number Diff line change @@ -54,7 +54,6 @@ func debugf(format string, a ...interface{}) {
5454
5555// Stack operations
5656func (vm * Vm ) STACK_LEVEL () int { return len (vm .frame .Stack ) }
57- func (vm * Vm ) EMPTY () bool { return len (vm .frame .Stack ) == 0 }
5857func (vm * Vm ) TOP () py.Object { return vm .frame .Stack [len (vm .frame .Stack )- 1 ] }
5958func (vm * Vm ) SECOND () py.Object { return vm .frame .Stack [len (vm .frame .Stack )- 2 ] }
6059func (vm * Vm ) THIRD () py.Object { return vm .frame .Stack [len (vm .frame .Stack )- 3 ] }
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3.4
2+
3+ # While
4+ a = 1
5+ while a < 10 :
6+ a += 1
7+ assert a == 10
8+
9+ # While else
10+ a = 1
11+ ok = False
12+ while a < 10 :
13+ a += 1
14+ else :
15+ ok = True
16+ assert a == 10
17+ assert ok
18+
19+ # While break
20+ a = 1
21+ ok = True
22+ while True :
23+ if a >= 10 :
24+ break
25+ a += 1
26+ else :
27+ ok = False
28+ assert a == 10
29+ assert ok
30+
31+ # While continue
32+ a = 1
33+ while a < 10 :
34+ if a == 5 :
35+ a += 1000
36+ continue
37+ a += 1
38+ assert a == 1005
39+
40+ # For
41+ a = 0
42+ for i in (1 ,2 ,3 ,4 ,5 ):
43+ a += i
44+ assert a == 15
45+
46+ # For else
47+ a = 0
48+ ok = False
49+ for i in (1 ,2 ,3 ,4 ,5 ):
50+ a += i
51+ else :
52+ ok = True
53+ assert a == 15
54+ assert ok
55+
56+ # For break
57+ a = 0
58+ ok = True
59+ for i in (1 ,2 ,3 ,4 ,5 ):
60+ if i >= 3 :
61+ break
62+ a += i
63+ else :
64+ ok = False
65+ assert a == 3
66+ assert ok
67+
68+ # For continue
69+ a = 0
70+ for i in (1 ,2 ,3 ,4 ,5 ):
71+ if i == 3 :
72+ continue
73+ a += i
74+ assert a == 12
75+
76+ # For continue in try/finally
77+ # FIXME doesn't work yet!
78+ # ok = False
79+ # a = 0
80+ # for i in (1,2,3,4,5):
81+ # if i == 3:
82+ # try:
83+ # continue
84+ # finally:
85+ # ok = True
86+ # a += i
87+ # assert a == 12
88+ # assert ok
89+
90+ # End with this
91+ finished = True
Original file line number Diff line number Diff line change 9393assert True is not False
9494# FIXME EXC_MATCH
9595
96+ # Multiple comparison
97+
98+ assert _2 < _10 < _11 < _100
99+ assert not (_10 < _2 < _11 < _100 )
100+ assert _100 > _11 > _10 > _2
101+
96102# logical
97103t = True
98104f = False
You can’t perform that action at this time.
0 commit comments