Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cpython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
cpython
Commits
d437095e
Commit
d437095e
authored
Dec 11, 2001
by
Guido van Rossum
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Additional coverage tests by Neil Norwitz.
(SF patch #491418, #491420, #491421.)
parent
96238a3a
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
87 additions
and
0 deletions
+87
-0
Lib/test/test_b1.py
Lib/test/test_b1.py
+12
-0
Lib/test/test_descr.py
Lib/test/test_descr.py
+66
-0
Lib/test/test_types.py
Lib/test/test_types.py
+9
-0
No files found.
Lib/test/test_b1.py
View file @
d437095e
...
...
@@ -23,6 +23,10 @@ if abs(0L) != 0L: raise TestFailed, 'abs(0L)'
if
abs
(
1234L
)
!=
1234L
:
raise
TestFailed
,
'abs(1234L)'
if
abs
(
-
1234L
)
!=
1234L
:
raise
TestFailed
,
'abs(-1234L)'
try
:
abs
(
'a'
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
'abs("a")'
print
'apply'
def
f0
(
*
args
):
if
args
!=
():
raise
TestFailed
,
'f0 called with '
+
`args`
...
...
@@ -416,6 +420,10 @@ x = -1-sys.maxint
if
x
>>
1
!=
x
//
2
:
raise
TestFailed
(
"x >> 1 != x/2 when x == -1-sys.maxint"
)
try
:
int
(
'123
\
0
'
)
except
ValueError
:
pass
else
:
raise
TestFailed
(
"int('123
\
0
') didn't raise exception"
)
print
'isinstance'
class
C
:
pass
...
...
@@ -504,6 +512,10 @@ for s, v in L + LL:
except
ValueError
,
e
:
raise
TestFailed
,
"long(%s) raised ValueError: %s"
%
(
`ss`
,
e
)
try
:
long
(
'123
\
0
'
)
except
ValueError
:
pass
else
:
raise
TestFailed
(
"long('123
\
0
') didn't raise exception"
)
print
'map'
if
map
(
None
,
'hello world'
)
!=
[
'h'
,
'e'
,
'l'
,
'l'
,
'o'
,
' '
,
'w'
,
'o'
,
'r'
,
'l'
,
'd'
]:
raise
TestFailed
,
'map(None,
\
'
hello world
\
'
)'
...
...
Lib/test/test_descr.py
View file @
d437095e
...
...
@@ -768,6 +768,12 @@ def metaclass():
vereq
(
type
(
a
),
C
)
vereq
(
T
.
counter
,
1
)
class
C
(
object
):
pass
c
=
C
()
try
:
c
()
except
TypeError
:
pass
else
:
raise
TestError
,
"calling object w/o call method should raise TypeError"
def
pymods
():
if
verbose
:
print
"Testing Python subclass of module..."
log
=
[]
...
...
@@ -2607,6 +2613,12 @@ def delhook():
del
c
vereq
(
log
,
[
1
])
class
D
(
object
):
pass
d
=
D
()
try
:
del
d
[
0
]
except
TypeError
:
pass
else
:
raise
TestFailed
,
"invalid del() didn't raise TypeError"
def
hashinherit
():
if
verbose
:
print
"Testing hash of mutable subclasses..."
...
...
@@ -2630,6 +2642,59 @@ def hashinherit():
else
:
raise
TestFailed
,
"hash() of list subclass should fail"
def
strops
():
try
:
'a'
+
5
except
TypeError
:
pass
else
:
raise
TestFailed
,
"'' + 5 doesn't raise TypeError"
try
:
''
.
split
(
''
)
except
ValueError
:
pass
else
:
raise
TestFailed
,
"''.split('') doesn't raise ValueError"
try
:
''
.
join
([
0
])
except
TypeError
:
pass
else
:
raise
TestFailed
,
"''.join([0]) doesn't raise TypeError"
try
:
''
.
rindex
(
'5'
)
except
ValueError
:
pass
else
:
raise
TestFailed
,
"''.rindex('5') doesn't raise ValueError"
try
:
''
.
replace
(
''
,
''
)
except
ValueError
:
pass
else
:
raise
TestFailed
,
"''.replace('', '') doesn't raise ValueError"
try
:
'%(n)s'
%
None
except
TypeError
:
pass
else
:
raise
TestFailed
,
"'%(n)s' % None doesn't raise TypeError"
try
:
'%(n'
%
{}
except
ValueError
:
pass
else
:
raise
TestFailed
,
"'%(n' % {} '' doesn't raise ValueError"
try
:
'%*s'
%
(
'abc'
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"'%*s' % ('abc') doesn't raise TypeError"
try
:
'%*.*s'
%
(
'abc'
,
5
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"'%*.*s' % ('abc', 5) doesn't raise TypeError"
try
:
'%s'
%
(
1
,
2
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
"'%s' % (1, 2) doesn't raise TypeError"
try
:
'%'
%
None
except
ValueError
:
pass
else
:
raise
TestFailed
,
"'%' % None doesn't raise ValueError"
vereq
(
'534253'
.
isdigit
(),
1
)
vereq
(
'534253x'
.
isdigit
(),
0
)
vereq
(
'%c'
%
5
,
'
\
x05
'
)
vereq
(
'%c'
%
'5'
,
'5'
)
def
test_main
():
class_docstrings
()
lists
()
...
...
@@ -2683,6 +2748,7 @@ def test_main():
kwdargs
()
delhook
()
hashinherit
()
strops
()
if
verbose
:
print
"All OK"
if
__name__
==
"__main__"
:
...
...
Lib/test/test_types.py
View file @
d437095e
...
...
@@ -389,3 +389,12 @@ for copymode in -1, +1:
str
(
ta
),
str
(
tb
))
if
a
:
raise
TestFailed
,
'a not empty after popitems: %s'
%
str
(
a
)
if
b
:
raise
TestFailed
,
'b not empty after popitems: %s'
%
str
(
b
)
try
:
type
(
1
,
2
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
'type(), w/2 args expected TypeError'
try
:
type
(
1
,
2
,
3
,
4
)
except
TypeError
:
pass
else
:
raise
TestFailed
,
'type(), w/4 args expected TypeError'
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment