Skip to content

Commit 92ab95f

Browse files
committed
tests: Add some tests to improve coverage.
1 parent 598af3a commit 92ab95f

6 files changed

Lines changed: 51 additions & 2 deletions

File tree

tests/basics/builtin_ellipsis.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# tests that .../Ellipsis exists
2+
3+
print(...)
4+
print(Ellipsis)
5+
6+
print(... == Ellipsis)

tests/basics/fun_largestate.py

Lines changed: 24 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
# test large function (stack) state
22

3+
# this function creates 127 locals
34
def f():
45
x0 = 1
56
x1 = 1
@@ -128,10 +129,31 @@ def f():
128129
x124 = 1
129130
x125 = 1
130131
x126 = 1
131-
132132
f()
133133

134+
# this function pushes 128 elements onto the function stack
134135
def g():
135136
x = [1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,]
136-
137137
g()
138+
139+
# this function exercises load_fast_n and store_fast_n opcodes
140+
def h():
141+
x0 = 1
142+
x1 = x0
143+
x2 = x1
144+
x3 = x2
145+
x4 = x3
146+
x5 = x4
147+
x6 = x5
148+
x7 = x6
149+
x8 = x7
150+
x9 = x8
151+
x10 = x9
152+
x11 = x10
153+
x12 = x11
154+
x13 = x12
155+
x14 = x13
156+
x15 = x14
157+
x16 = x15
158+
x17 = x16
159+
h()

tests/basics/list_slice.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@
1616
print(x[a:b])
1717
print(x[a:b:])
1818
#print(x[a:b:c])
19+
20+
# these should not raise IndexError
21+
print([][1:])
22+
print([][-1:])

tests/io/file_readline.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
f = open("io/data/file1")
2+
print(f.readline())
3+
print(f.readline(3))
4+
print(f.readline(4))
5+
print(f.readline(5))
6+
print(f.readline())

tests/unicode/data/utf-8_2.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
aαbβcγdδ
2+
ぁ🙐

tests/unicode/file2.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ def do(mode):
1010
print(f.read(1))
1111
print(f.read(2))
1212
print(f.read(4))
13+
14+
# skip to end of line
15+
f.readline()
16+
17+
# check 3-byte utf-8 char
18+
print(f.read(1 if mode == 'rt' else 3))
19+
20+
# check 4-byte utf-8 char
21+
print(f.read(1 if mode == 'rt' else 4))
22+
1323
f.close()
1424

1525
do('rb')

0 commit comments

Comments
 (0)