Skip to content
This repository was archived by the owner on Mar 27, 2024. It is now read-only.

Commit 8e38ea8

Browse files
committed
Further coverage improvements
1 parent 65b0388 commit 8e38ea8

4 files changed

Lines changed: 40 additions & 4 deletions

File tree

doc/faq.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,10 @@ There is a comprehensive test suite. Since Python already exists it
6565
provides something to verify answers against. The test harness is
6666
written in Python.
6767

68-
There is over 99% line coverage **and** branch coverage in the code.
69-
While this doesn't guarantee the absence of bugs, it at least assures
70-
that the vast majority of code is tested. (The remaining uncovered
71-
5 lines are some defensive coding around reflection in Java.)
68+
There is over 99% line coverage and similar branch coverage in the
69+
code. While this doesn't guarantee the absence of bugs, it at least
70+
assures that the vast majority of code is tested. (The remaining
71+
lines/branches are generally defensive coding.)
7272

7373
The scope being limited (note "Mini" in the name!) there is also less
7474
functionality and less to go wrong.

test/errors.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,14 @@
2929
3/{}
3030
#> TypeError:.*bool.*
3131
True/3
32+
#> TypeError
33+
3+"3"
34+
#> TypeError
35+
"3"+3
36+
#> TypeError
37+
3+[]
38+
#> TypeError
39+
[]+3
3240
#> ArithmeticException
3341
1/0
3442
#> TypeError:
@@ -102,6 +110,10 @@
102110
#> TypeError
103111
# see above
104112
del [1,2,3][2:]
113+
#> TypeError
114+
{}.update("fdsfds")
115+
#> TypeError
116+
"dsfdsf".startswith([])
105117

106118
#> NameError
107119
name=3
@@ -244,6 +256,9 @@ def meth():
244256
#> TypeError.*callable.*
245257
[].sort(True)
246258

259+
#> .*(ClassCastException|TypeError: Got str expected int).*
260+
[1,2,3].sort(lambda l,r: "not an int")
261+
247262
#> AssertionError
248263
def meth(a,b):
249264
assert False
@@ -266,6 +281,11 @@ def meth(a,b):
266281
x=test1.call
267282
apply(test1.call, ["x"]*65536)
268283

284+
#> RuntimeError.*stack.*
285+
def recursive(x,y,z):
286+
return x+recursive(3,4,5)
287+
recursive(1,2,3)
288+
269289
#> TypeError
270290
test1.vacall(3)
271291
#> TypeError

test/general.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -303,3 +303,10 @@ def foo(opop):
303303
assert test1.toPyReprString(True)=='True'
304304
assert test1.toPyReprString("a\n\t\"")==r'"a\n\t\""'
305305
assert test1.toPyReprString("\\")==r'"\\"'
306+
307+
assert globals()["globals"]==globals
308+
309+
def foo():
310+
return len(locals())
311+
312+
assert foo()==0

test/list.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,3 +113,12 @@
113113
l2.sort(cmp)
114114

115115
assert l1==l2
116+
117+
l1=[4,5,"4","04", {}, []]
118+
l1.append(l1)
119+
l2=l1[:]
120+
121+
l1.sort()
122+
l2.sort(lambda l,r: -cmp(l,r), None, True)
123+
124+
assert l1==l2

0 commit comments

Comments
 (0)