Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zope
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
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
Zope
Commits
206bd882
Commit
206bd882
authored
Aug 08, 2010
by
Hanno Schlichting
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updated the remaining test assertions
parent
6220f215
Changes
13
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
58 additions
and
58 deletions
+58
-58
doc/CHANGES.rst
doc/CHANGES.rst
+2
-2
src/OFS/tests/testFileAndImage.py
src/OFS/tests/testFileAndImage.py
+2
-2
src/OFS/tests/testOrderSupport.py
src/OFS/tests/testOrderSupport.py
+6
-6
src/OFS/tests/testTraverse.py
src/OFS/tests/testTraverse.py
+7
-7
src/OFS/tests/test_userfolder.py
src/OFS/tests/test_userfolder.py
+1
-1
src/Products/PageTemplates/tests/test_ptfile.py
src/Products/PageTemplates/tests/test_ptfile.py
+2
-2
src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
+10
-10
src/Products/Transience/tests/testTransientObject.py
src/Products/Transience/tests/testTransientObject.py
+3
-3
src/Testing/ZopeTestCase/testBaseTestCase.py
src/Testing/ZopeTestCase/testBaseTestCase.py
+11
-11
src/Testing/ZopeTestCase/testZODBCompat.py
src/Testing/ZopeTestCase/testZODBCompat.py
+2
-2
src/ZPublisher/tests/testBaseRequest.py
src/ZPublisher/tests/testBaseRequest.py
+3
-3
src/ZPublisher/tests/test_mapply.py
src/ZPublisher/tests/test_mapply.py
+5
-5
src/Zope2/Startup/tests/testStarter.py
src/Zope2/Startup/tests/testStarter.py
+4
-4
No files found.
doc/CHANGES.rst
View file @
206bd882
...
@@ -15,8 +15,8 @@ Bugs Fixed
...
@@ -15,8 +15,8 @@ Bugs Fixed
Features Added
Features Added
++++++++++++++
++++++++++++++
-
Replaced failUnless with assertTrue and failIf with assertFalse in tests.
-
Updated test assertions to use unittest's ``assert*`` methods in favor of
their deprecated `fail*` aliases.
2.13.0a3 (2010-08-04)
2.13.0a3 (2010-08-04)
---------------------
---------------------
...
...
src/OFS/tests/testFileAndImage.py
View file @
206bd882
...
@@ -195,10 +195,10 @@ class FileTests(unittest.TestCase):
...
@@ -195,10 +195,10 @@ class FileTests(unittest.TestCase):
# From a file
# From a file
s
=
"a"
*
(
1
<<
16
)
*
3
s
=
"a"
*
(
1
<<
16
)
*
3
data
,
size
=
self
.
file
.
_read_data
(
StringIO
(
s
))
data
,
size
=
self
.
file
.
_read_data
(
StringIO
(
s
))
self
.
failIf
Equal
(
data
.
next
,
None
)
self
.
assertNot
Equal
(
data
.
next
,
None
)
# From a string
# From a string
data
,
size
=
self
.
file
.
_read_data
(
s
)
data
,
size
=
self
.
file
.
_read_data
(
s
)
self
.
failIf
Equal
(
data
.
next
,
None
)
self
.
assertNot
Equal
(
data
.
next
,
None
)
def
testManageEditWithFileData
(
self
):
def
testManageEditWithFileData
(
self
):
self
.
file
.
manage_edit
(
'foobar'
,
'text/plain'
,
filedata
=
'ASD'
)
self
.
file
.
manage_edit
(
'foobar'
,
'text/plain'
,
filedata
=
'ASD'
)
...
...
src/OFS/tests/testOrderSupport.py
View file @
206bd882
...
@@ -54,10 +54,10 @@ class TestOrderSupport(unittest.TestCase):
...
@@ -54,10 +54,10 @@ class TestOrderSupport(unittest.TestCase):
f
=
self
.
_makeOne
()
f
=
self
.
_makeOne
()
method
=
getattr
(
f
,
methodname
)
method
=
getattr
(
f
,
methodname
)
if
rval
==
'ValueError'
:
if
rval
==
'ValueError'
:
self
.
failUnless
Raises
(
ValueError
,
method
,
*
args
)
self
.
assert
Raises
(
ValueError
,
method
,
*
args
)
else
:
else
:
self
.
failUnless
Equal
(
method
(
*
args
),
rval
)
self
.
assert
Equal
(
method
(
*
args
),
rval
)
self
.
failUnless
Equal
(
f
.
objectIds
(),
order
)
self
.
assert
Equal
(
f
.
objectIds
(),
order
)
def
test_moveObjectsUp
(
self
):
def
test_moveObjectsUp
(
self
):
self
.
_doCanonTest
(
'moveObjectsUp'
,
self
.
_doCanonTest
(
'moveObjectsUp'
,
...
@@ -157,13 +157,13 @@ class TestOrderSupport(unittest.TestCase):
...
@@ -157,13 +157,13 @@ class TestOrderSupport(unittest.TestCase):
f
.
o2
.
isPrincipiaFolderish
=
True
f
.
o2
.
isPrincipiaFolderish
=
True
f
.
o3
.
isPrincipiaFolderish
=
True
f
.
o3
.
isPrincipiaFolderish
=
True
f
.
o4
.
isPrincipiaFolderish
=
True
f
.
o4
.
isPrincipiaFolderish
=
True
self
.
failUnless
Equal
(
f
.
tpValues
(),
[
f
.
o2
,
f
.
o3
,
f
.
o4
]
)
self
.
assert
Equal
(
f
.
tpValues
(),
[
f
.
o2
,
f
.
o3
,
f
.
o4
]
)
f
.
setDefaultSorting
(
'meta_type'
,
False
)
f
.
setDefaultSorting
(
'meta_type'
,
False
)
self
.
failUnless
Equal
(
f
.
tpValues
(),
[
f
.
o3
,
f
.
o2
,
f
.
o4
]
)
self
.
assert
Equal
(
f
.
tpValues
(),
[
f
.
o3
,
f
.
o2
,
f
.
o4
]
)
f
.
setDefaultSorting
(
'position'
,
True
)
f
.
setDefaultSorting
(
'position'
,
True
)
self
.
failUnless
Equal
(
f
.
tpValues
(),
[
f
.
o4
,
f
.
o3
,
f
.
o2
]
)
self
.
assert
Equal
(
f
.
tpValues
(),
[
f
.
o4
,
f
.
o3
,
f
.
o2
]
)
def
test_suite
():
def
test_suite
():
...
...
src/OFS/tests/testTraverse.py
View file @
206bd882
...
@@ -248,12 +248,12 @@ class TestTraverse( unittest.TestCase ):
...
@@ -248,12 +248,12 @@ class TestTraverse( unittest.TestCase ):
self
.
assertTrue
(
self
.
folder1
.
unrestrictedTraverse
(
'/folder1/'
))
self
.
assertTrue
(
self
.
folder1
.
unrestrictedTraverse
(
'/folder1/'
))
def
testTraverseToNone
(
self
):
def
testTraverseToNone
(
self
):
self
.
failUnless
Raises
(
self
.
assert
Raises
(
KeyError
,
KeyError
,
self
.
folder1
.
unrestrictedTraverse
,
(
''
,
'folder1'
,
'file2'
)
)
self
.
folder1
.
unrestrictedTraverse
,
(
''
,
'folder1'
,
'file2'
)
)
self
.
failUnless
Raises
(
self
.
assert
Raises
(
KeyError
,
self
.
folder1
.
unrestrictedTraverse
,
'/folder1/file2'
)
KeyError
,
self
.
folder1
.
unrestrictedTraverse
,
'/folder1/file2'
)
self
.
failUnless
Raises
(
self
.
assert
Raises
(
KeyError
,
self
.
folder1
.
unrestrictedTraverse
,
'/folder1/file2/'
)
KeyError
,
self
.
folder1
.
unrestrictedTraverse
,
'/folder1/file2/'
)
def
testTraverseMethodRestricted
(
self
):
def
testTraverseMethodRestricted
(
self
):
...
@@ -272,7 +272,7 @@ class TestTraverse( unittest.TestCase ):
...
@@ -272,7 +272,7 @@ class TestTraverse( unittest.TestCase ):
# Zope security policy.
# Zope security policy.
self
.
_setupSecurity
()
self
.
_setupSecurity
()
bb
=
self
.
_makeBoboTraversable
()
bb
=
self
.
_makeBoboTraversable
()
self
.
failUnless
Raises
(
KeyError
,
bb
.
restrictedTraverse
,
'notfound'
)
self
.
assert
Raises
(
KeyError
,
bb
.
restrictedTraverse
,
'notfound'
)
bb
.
restrictedTraverse
(
'bb_subitem'
)
bb
.
restrictedTraverse
(
'bb_subitem'
)
def
testBoboTraverseToMethod
(
self
):
def
testBoboTraverseToMethod
(
self
):
...
@@ -323,7 +323,7 @@ class TestTraverse( unittest.TestCase ):
...
@@ -323,7 +323,7 @@ class TestTraverse( unittest.TestCase ):
folder
.
manage_permission
(
access_contents_information
,
[],
0
)
folder
.
manage_permission
(
access_contents_information
,
[],
0
)
bb
=
self
.
_makeBoboTraversableWithAcquisition
()
bb
=
self
.
_makeBoboTraversableWithAcquisition
()
bb
=
bb
.
__of__
(
self
.
root
)
bb
=
bb
.
__of__
(
self
.
root
)
self
.
failUnless
Raises
(
Unauthorized
,
self
.
assert
Raises
(
Unauthorized
,
bb
.
restrictedTraverse
,
'folder1'
)
bb
.
restrictedTraverse
,
'folder1'
)
def
testBoboTraverseToAcquiredAttribute
(
self
):
def
testBoboTraverseToAcquiredAttribute
(
self
):
...
@@ -349,7 +349,7 @@ class TestTraverse( unittest.TestCase ):
...
@@ -349,7 +349,7 @@ class TestTraverse( unittest.TestCase ):
folder
.
stuff
=
'stuff here'
folder
.
stuff
=
'stuff here'
bb
=
self
.
_makeBoboTraversableWithAcquisition
()
bb
=
self
.
_makeBoboTraversableWithAcquisition
()
bb
=
bb
.
__of__
(
folder
)
bb
=
bb
.
__of__
(
folder
)
self
.
failUnless
Raises
(
Unauthorized
,
self
.
assert
Raises
(
Unauthorized
,
self
.
root
.
folder1
.
restrictedTraverse
,
'stuff'
)
self
.
root
.
folder1
.
restrictedTraverse
,
'stuff'
)
def
testBoboTraverseTraversalDefault
(
self
):
def
testBoboTraverseTraversalDefault
(
self
):
...
@@ -389,7 +389,7 @@ class TestTraverse( unittest.TestCase ):
...
@@ -389,7 +389,7 @@ class TestTraverse( unittest.TestCase ):
self
.
_setupSecurity
(
CruelSecurityPolicy
())
self
.
_setupSecurity
(
CruelSecurityPolicy
())
newSecurityManager
(
None
,
self
.
_makeUser
().
__of__
(
self
.
root
)
)
newSecurityManager
(
None
,
self
.
_makeUser
().
__of__
(
self
.
root
)
)
self
.
root
.
stuff
=
'stuff here'
self
.
root
.
stuff
=
'stuff here'
self
.
failUnless
Raises
(
Unauthorized
,
self
.
assert
Raises
(
Unauthorized
,
self
.
app
.
folder1
.
restrictedTraverse
,
'stuff'
)
self
.
app
.
folder1
.
restrictedTraverse
,
'stuff'
)
def
testDefaultValueWhenUnathorized
(
self
):
def
testDefaultValueWhenUnathorized
(
self
):
...
...
src/OFS/tests/test_userfolder.py
View file @
206bd882
...
@@ -123,7 +123,7 @@ class UserFolderTests(unittest.TestCase):
...
@@ -123,7 +123,7 @@ class UserFolderTests(unittest.TestCase):
uf
=
self
.
_makeOne
(
app
)
uf
=
self
.
_makeOne
(
app
)
user
=
uf
.
validate
(
app
.
REQUEST
,
self
.
_makeBasicAuthToken
(),
user
=
uf
.
validate
(
app
.
REQUEST
,
self
.
_makeBasicAuthToken
(),
[
'role1'
])
[
'role1'
])
self
.
failIf
Equal
(
user
,
None
)
self
.
assertNot
Equal
(
user
,
None
)
self
.
assertEqual
(
user
.
getUserName
(),
'user1'
)
self
.
assertEqual
(
user
.
getUserName
(),
'user1'
)
def
testNotValidateWithoutAuth
(
self
):
def
testNotValidateWithoutAuth
(
self
):
...
...
src/Products/PageTemplates/tests/test_ptfile.py
View file @
206bd882
...
@@ -135,7 +135,7 @@ class TypeSniffingTestCase(unittest.TestCase):
...
@@ -135,7 +135,7 @@ class TypeSniffingTestCase(unittest.TestCase):
f
.
close
()
f
.
close
()
pt
=
PageTemplateFile
(
self
.
TEMPFILENAME
)
pt
=
PageTemplateFile
(
self
.
TEMPFILENAME
)
pt_id
=
pt
.
getId
()
pt_id
=
pt
.
getId
()
self
.
failUnless
Equal
(
self
.
assert
Equal
(
pt_id
,
desired_id
,
pt_id
,
desired_id
,
'getId() returned %r. Expecting %r'
%
(
pt_id
,
desired_id
)
'getId() returned %r. Expecting %r'
%
(
pt_id
,
desired_id
)
)
)
...
@@ -148,7 +148,7 @@ class TypeSniffingTestCase(unittest.TestCase):
...
@@ -148,7 +148,7 @@ class TypeSniffingTestCase(unittest.TestCase):
f
.
close
()
f
.
close
()
pt
=
PageTemplateFile
(
self
.
TEMPFILENAME
)
pt
=
PageTemplateFile
(
self
.
TEMPFILENAME
)
pt_path
=
pt
.
getPhysicalPath
()
pt_path
=
pt
.
getPhysicalPath
()
self
.
failUnless
Equal
(
self
.
assert
Equal
(
pt_path
,
desired_path
,
pt_path
,
desired_path
,
'getPhysicalPath() returned %r. Expecting %r'
%
(
'getPhysicalPath() returned %r. Expecting %r'
%
(
desired_path
,
pt_path
,
desired_path
,
pt_path
,
...
...
src/Products/PluginIndexes/DateIndex/tests/test_DateIndex.py
View file @
206bd882
...
@@ -136,8 +136,8 @@ class DI_Tests(unittest.TestCase):
...
@@ -136,8 +136,8 @@ class DI_Tests(unittest.TestCase):
result
,
used
=
index
.
_apply_index
(
req
)
result
,
used
=
index
.
_apply_index
(
req
)
if
hasattr
(
result
,
'keys'
):
if
hasattr
(
result
,
'keys'
):
result
=
result
.
keys
()
result
=
result
.
keys
()
self
.
failUnless
Equal
(
used
,
(
'date'
,))
self
.
assert
Equal
(
used
,
(
'date'
,))
self
.
failUnless
Equal
(
len
(
result
),
len
(
expectedValues
),
self
.
assert
Equal
(
len
(
result
),
len
(
expectedValues
),
'%s | %s'
%
(
result
,
expectedValues
))
'%s | %s'
%
(
result
,
expectedValues
))
for
k
,
v
in
expectedValues
:
for
k
,
v
in
expectedValues
:
self
.
assertTrue
(
k
in
result
)
self
.
assertTrue
(
k
in
result
)
...
@@ -175,8 +175,8 @@ class DI_Tests(unittest.TestCase):
...
@@ -175,8 +175,8 @@ class DI_Tests(unittest.TestCase):
from
DateTime
import
DateTime
from
DateTime
import
DateTime
index
=
self
.
_makeOne
()
index
=
self
.
_makeOne
()
self
.
failUnless
Equal
(
len
(
index
),
0
)
self
.
assert
Equal
(
len
(
index
),
0
)
self
.
failUnless
Equal
(
len
(
index
.
referencedObjects
()),
0
)
self
.
assert
Equal
(
len
(
index
.
referencedObjects
()),
0
)
self
.
assertTrue
(
index
.
getEntryForObject
(
1234
)
is
None
)
self
.
assertTrue
(
index
.
getEntryForObject
(
1234
)
is
None
)
marker
=
[]
marker
=
[]
...
@@ -185,7 +185,7 @@ class DI_Tests(unittest.TestCase):
...
@@ -185,7 +185,7 @@ class DI_Tests(unittest.TestCase):
self
.
assertTrue
(
index
.
hasUniqueValuesFor
(
'date'
))
self
.
assertTrue
(
index
.
hasUniqueValuesFor
(
'date'
))
self
.
assertFalse
(
index
.
hasUniqueValuesFor
(
'foo'
))
self
.
assertFalse
(
index
.
hasUniqueValuesFor
(
'foo'
))
self
.
failUnless
Equal
(
len
(
index
.
uniqueValues
(
'date'
)),
0
)
self
.
assert
Equal
(
len
(
index
.
uniqueValues
(
'date'
)),
0
)
self
.
assertTrue
(
index
.
_apply_index
({
'zed'
:
12345
})
is
None
)
self
.
assertTrue
(
index
.
_apply_index
({
'zed'
:
12345
})
is
None
)
...
@@ -211,8 +211,8 @@ class DI_Tests(unittest.TestCase):
...
@@ -211,8 +211,8 @@ class DI_Tests(unittest.TestCase):
self
.
_populateIndex
(
index
)
self
.
_populateIndex
(
index
)
values
=
self
.
_getValues
()
values
=
self
.
_getValues
()
self
.
failUnless
Equal
(
len
(
index
),
len
(
values
)
-
2
)
# One dupe, one empty
self
.
assert
Equal
(
len
(
index
),
len
(
values
)
-
2
)
# One dupe, one empty
self
.
failUnless
Equal
(
len
(
index
.
referencedObjects
()),
len
(
values
)
-
1
)
self
.
assert
Equal
(
len
(
index
.
referencedObjects
()),
len
(
values
)
-
1
)
# One empty
# One empty
self
.
assertTrue
(
index
.
getEntryForObject
(
1234
)
is
None
)
self
.
assertTrue
(
index
.
getEntryForObject
(
1234
)
is
None
)
...
@@ -222,10 +222,10 @@ class DI_Tests(unittest.TestCase):
...
@@ -222,10 +222,10 @@ class DI_Tests(unittest.TestCase):
for
k
,
v
in
values
:
for
k
,
v
in
values
:
if
v
.
date
():
if
v
.
date
():
self
.
failUnless
Equal
(
index
.
getEntryForObject
(
k
),
self
.
assert
Equal
(
index
.
getEntryForObject
(
k
),
self
.
_convert
(
v
.
date
()))
self
.
_convert
(
v
.
date
()))
self
.
failUnless
Equal
(
len
(
index
.
uniqueValues
(
'date'
)),
len
(
values
)
-
2
)
self
.
assert
Equal
(
len
(
index
.
uniqueValues
(
'date'
)),
len
(
values
)
-
2
)
self
.
assertTrue
(
index
.
_apply_index
({
'bar'
:
123
})
is
None
)
self
.
assertTrue
(
index
.
_apply_index
({
'bar'
:
123
})
is
None
)
self
.
_checkApply
(
index
,
self
.
_checkApply
(
index
,
...
@@ -258,7 +258,7 @@ class DI_Tests(unittest.TestCase):
...
@@ -258,7 +258,7 @@ class DI_Tests(unittest.TestCase):
# and still correct for item 10
# and still correct for item 10
yr
,
mo
,
dy
,
hr
,
mn
=
v
.
date
().
utctimetuple
()[:
5
]
yr
,
mo
,
dy
,
hr
,
mn
=
v
.
date
().
utctimetuple
()[:
5
]
val
=
(((
yr
*
12
+
mo
)
*
31
+
dy
)
*
24
+
hr
)
*
60
+
mn
val
=
(((
yr
*
12
+
mo
)
*
31
+
dy
)
*
24
+
hr
)
*
60
+
mn
self
.
failUnless
Equal
(
index
.
getEntryForObject
(
k
),
val
)
self
.
assert
Equal
(
index
.
getEntryForObject
(
k
),
val
)
def
test_removal
(
self
):
def
test_removal
(
self
):
""" DateIndex would hand back spurious entries when used as a
""" DateIndex would hand back spurious entries when used as a
...
...
src/Products/Transience/tests/testTransientObject.py
View file @
206bd882
...
@@ -36,7 +36,7 @@ class TestTransientObject(TestCase):
...
@@ -36,7 +36,7 @@ class TestTransientObject(TestCase):
def
test_id
(
self
):
def
test_id
(
self
):
t
=
self
.
t
.
new
(
'xyzzy'
)
t
=
self
.
t
.
new
(
'xyzzy'
)
self
.
failIf
Equal
(
t
.
getId
(),
'xyzzy'
)
# dont acquire
self
.
assertNot
Equal
(
t
.
getId
(),
'xyzzy'
)
# dont acquire
self
.
assertEqual
(
t
.
getContainerKey
(),
'xyzzy'
)
self
.
assertEqual
(
t
.
getContainerKey
(),
'xyzzy'
)
def
test_validate
(
self
):
def
test_validate
(
self
):
...
@@ -62,12 +62,12 @@ class TestTransientObject(TestCase):
...
@@ -62,12 +62,12 @@ class TestTransientObject(TestCase):
def
test_getLastModifiedSet
(
self
):
def
test_getLastModifiedSet
(
self
):
t
=
self
.
t
.
new
(
'xyzzy'
)
t
=
self
.
t
.
new
(
'xyzzy'
)
t
[
'a'
]
=
1
t
[
'a'
]
=
1
self
.
failIf
Equal
(
t
.
getLastModified
(),
None
)
self
.
assertNot
Equal
(
t
.
getLastModified
(),
None
)
def
testSetLastModified
(
self
):
def
testSetLastModified
(
self
):
t
=
self
.
t
.
new
(
'xyzzy'
)
t
=
self
.
t
.
new
(
'xyzzy'
)
t
.
setLastModified
()
t
.
setLastModified
()
self
.
failIf
Equal
(
t
.
getLastModified
(),
None
)
self
.
assertNot
Equal
(
t
.
getLastModified
(),
None
)
def
test_setLastAccessed
(
self
):
def
test_setLastAccessed
(
self
):
t
=
self
.
t
.
new
(
'xyzzy'
)
t
=
self
.
t
.
new
(
'xyzzy'
)
...
...
src/Testing/ZopeTestCase/testBaseTestCase.py
View file @
206bd882
...
@@ -372,17 +372,17 @@ class TestRequestVariables(base.TestCase):
...
@@ -372,17 +372,17 @@ class TestRequestVariables(base.TestCase):
def
testRequestVariables
(
self
):
def
testRequestVariables
(
self
):
request
=
self
.
app
.
REQUEST
request
=
self
.
app
.
REQUEST
self
.
failIf
Equal
(
request
.
get
(
'SERVER_NAME'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'SERVER_NAME'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'SERVER_PORT'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'SERVER_PORT'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'REQUEST_METHOD'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'REQUEST_METHOD'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'URL'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'URL'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'SERVER_URL'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'SERVER_URL'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'URL0'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'URL0'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'URL1'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'URL1'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'BASE0'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'BASE0'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'BASE1'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'BASE1'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'BASE2'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'BASE2'
,
''
),
''
)
self
.
failIf
Equal
(
request
.
get
(
'ACTUAL_URL'
,
''
),
''
)
self
.
assertNot
Equal
(
request
.
get
(
'ACTUAL_URL'
,
''
),
''
)
import
gc
import
gc
...
...
src/Testing/ZopeTestCase/testZODBCompat.py
View file @
206bd882
...
@@ -70,7 +70,7 @@ class TestCopyPaste(ZopeTestCase.ZopeTestCase):
...
@@ -70,7 +70,7 @@ class TestCopyPaste(ZopeTestCase.ZopeTestCase):
# _p_oids are None until we commit a subtransaction
# _p_oids are None until we commit a subtransaction
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
self
.
failIf
Equal
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertNot
Equal
(
self
.
folder
.
_p_oid
,
None
)
def
testCutPaste
(
self
):
def
testCutPaste
(
self
):
cb
=
self
.
folder
.
manage_cutObjects
([
'doc'
])
cb
=
self
.
folder
.
manage_cutObjects
([
'doc'
])
...
@@ -121,7 +121,7 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
...
@@ -121,7 +121,7 @@ class TestImportExport(ZopeTestCase.ZopeTestCase):
# _p_oids are None until we commit a subtransaction
# _p_oids are None until we commit a subtransaction
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertEqual
(
self
.
folder
.
_p_oid
,
None
)
transaction
.
savepoint
(
optimistic
=
True
)
transaction
.
savepoint
(
optimistic
=
True
)
self
.
failIf
Equal
(
self
.
folder
.
_p_oid
,
None
)
self
.
assertNot
Equal
(
self
.
folder
.
_p_oid
,
None
)
def
testExport
(
self
):
def
testExport
(
self
):
self
.
folder
.
manage_exportObject
(
'doc'
)
self
.
folder
.
manage_exportObject
(
'doc'
)
...
...
src/ZPublisher/tests/testBaseRequest.py
View file @
206bd882
...
@@ -260,7 +260,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
...
@@ -260,7 +260,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
folder
.
_setObject
(
'objWithBD'
,
self
.
_makeObjectWithBD
())
folder
.
_setObject
(
'objWithBD'
,
self
.
_makeObjectWithBD
())
folder
.
objWithBD
.
_default_path
=
[
''
]
folder
.
objWithBD
.
_default_path
=
[
''
]
r
=
self
.
_makeOne
(
root
)
r
=
self
.
_makeOne
(
root
)
self
.
failUnless
Raises
(
NotFound
,
r
.
traverse
,
'folder/objWithBD'
)
self
.
assert
Raises
(
NotFound
,
r
.
traverse
,
'folder/objWithBD'
)
def
test_traverse_withBBT_handles_AttributeError
(
self
):
def
test_traverse_withBBT_handles_AttributeError
(
self
):
# Test that if __bobo_traverse__ raises AttributeError
# Test that if __bobo_traverse__ raises AttributeError
...
@@ -273,7 +273,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
...
@@ -273,7 +273,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
obj
.
__bobo_traverse__
=
_faux___bobo_traverse__
obj
.
__bobo_traverse__
=
_faux___bobo_traverse__
folder
.
_setObject
(
'objWithBBT'
,
obj
)
folder
.
_setObject
(
'objWithBBT'
,
obj
)
r
=
self
.
_makeOne
(
root
)
r
=
self
.
_makeOne
(
root
)
self
.
failUnless
Raises
(
NotFound
,
r
.
traverse
,
self
.
assert
Raises
(
NotFound
,
r
.
traverse
,
'folder/objWithBBT/bbt_foo'
)
'folder/objWithBBT/bbt_foo'
)
def
test_traverse_UseTraversalDefault
(
self
):
def
test_traverse_UseTraversalDefault
(
self
):
...
@@ -309,7 +309,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
...
@@ -309,7 +309,7 @@ class TestBaseRequest(unittest.TestCase, BaseRequest_factory):
folder
.
_setObject
(
'objWithBDBBT'
,
self
.
_makeObjectWithBDBBT
())
folder
.
_setObject
(
'objWithBDBBT'
,
self
.
_makeObjectWithBDBBT
())
folder
.
objWithBDBBT
.
_default_path
=
[
'xxx'
]
folder
.
objWithBDBBT
.
_default_path
=
[
'xxx'
]
r
=
self
.
_makeOne
(
root
)
r
=
self
.
_makeOne
(
root
)
self
.
failUnless
Raises
(
NotFound
,
r
.
traverse
,
'folder/objWithBDBBT'
)
self
.
assert
Raises
(
NotFound
,
r
.
traverse
,
'folder/objWithBDBBT'
)
def
test_traverse_slash
(
self
):
def
test_traverse_slash
(
self
):
root
,
folder
=
self
.
_makeRootAndFolder
()
root
,
folder
=
self
.
_makeRootAndFolder
()
...
...
src/ZPublisher/tests/test_mapply.py
View file @
206bd882
...
@@ -25,10 +25,10 @@ class MapplyTests(unittest.TestCase):
...
@@ -25,10 +25,10 @@ class MapplyTests(unittest.TestCase):
return
'%d%d%d'
%
(
a
,
b
,
c
)
return
'%d%d%d'
%
(
a
,
b
,
c
)
values
=
{
'a'
:
2
,
'b'
:
3
,
'c'
:
5
}
values
=
{
'a'
:
2
,
'b'
:
3
,
'c'
:
5
}
v
=
mapply
(
compute
,
(),
values
)
v
=
mapply
(
compute
,
(),
values
)
self
.
failUnless
Equal
(
v
,
'235'
)
self
.
assert
Equal
(
v
,
'235'
)
v
=
mapply
(
compute
,
(
7
,),
values
)
v
=
mapply
(
compute
,
(
7
,),
values
)
self
.
failUnless
Equal
(
v
,
'735'
)
self
.
assert
Equal
(
v
,
'735'
)
def
testClass
(
self
):
def
testClass
(
self
):
values
=
{
'a'
:
2
,
'b'
:
3
,
'c'
:
5
}
values
=
{
'a'
:
2
,
'b'
:
3
,
'c'
:
5
}
...
@@ -39,11 +39,11 @@ class MapplyTests(unittest.TestCase):
...
@@ -39,11 +39,11 @@ class MapplyTests(unittest.TestCase):
compute
=
__call__
compute
=
__call__
cc
=
c
()
cc
=
c
()
v
=
mapply
(
cc
,
(),
values
)
v
=
mapply
(
cc
,
(),
values
)
self
.
failUnless
Equal
(
v
,
'335'
)
self
.
assert
Equal
(
v
,
'335'
)
del
values
[
'c'
]
del
values
[
'c'
]
v
=
mapply
(
cc
.
compute
,
(),
values
)
v
=
mapply
(
cc
.
compute
,
(),
values
)
self
.
failUnless
Equal
(
v
,
'334'
)
self
.
assert
Equal
(
v
,
'334'
)
class
c2
:
class
c2
:
"""Must be a classic class."""
"""Must be a classic class."""
...
@@ -51,7 +51,7 @@ class MapplyTests(unittest.TestCase):
...
@@ -51,7 +51,7 @@ class MapplyTests(unittest.TestCase):
c2inst
=
c2
()
c2inst
=
c2
()
c2inst
.
__call__
=
cc
c2inst
.
__call__
=
cc
v
=
mapply
(
c2inst
,
(),
values
)
v
=
mapply
(
c2inst
,
(),
values
)
self
.
failUnless
Equal
(
v
,
'334'
)
self
.
assert
Equal
(
v
,
'334'
)
def
testObjectWithCall
(
self
):
def
testObjectWithCall
(
self
):
# Make sure that the __call__ of an object can also be another
# Make sure that the __call__ of an object can also be another
...
...
src/Zope2/Startup/tests/testStarter.py
View file @
206bd882
...
@@ -156,7 +156,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
...
@@ -156,7 +156,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
# XXX need to check that log messages get written to
# XXX need to check that log messages get written to
# sys.stderr, not that the stream identity for the startup
# sys.stderr, not that the stream identity for the startup
# handler matches
# handler matches
#self.
failUnless
Equal(starter.startup_handler.stream, sys.stderr)
#self.
assert
Equal(starter.startup_handler.stream, sys.stderr)
conf
=
self
.
load_config_text
(
"""
conf
=
self
.
load_config_text
(
"""
instancehome <<INSTANCE_HOME>>
instancehome <<INSTANCE_HOME>>
debug-mode off
debug-mode off
...
@@ -172,7 +172,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
...
@@ -172,7 +172,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
# XXX need to check that log messages get written to
# XXX need to check that log messages get written to
# sys.stderr, not that the stream identity for the startup
# sys.stderr, not that the stream identity for the startup
# handler matches
# handler matches
#self.
failIf
Equal(starter.startup_handler.stream, sys.stderr)
#self.
assertNot
Equal(starter.startup_handler.stream, sys.stderr)
def
testSetupZServerThreads
(
self
):
def
testSetupZServerThreads
(
self
):
conf
=
self
.
load_config_text
(
"""
conf
=
self
.
load_config_text
(
"""
...
@@ -361,7 +361,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
...
@@ -361,7 +361,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
try
:
try
:
starter
=
self
.
get_starter
(
conf
)
starter
=
self
.
get_starter
(
conf
)
starter
.
setupInterpreter
()
starter
.
setupInterpreter
()
self
.
failUnless
Equal
(
sys
.
getcheckinterval
()
,
newcheckinterval
)
self
.
assert
Equal
(
sys
.
getcheckinterval
()
,
newcheckinterval
)
finally
:
finally
:
sys
.
setcheckinterval
(
oldcheckinterval
)
sys
.
setcheckinterval
(
oldcheckinterval
)
...
@@ -385,7 +385,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
...
@@ -385,7 +385,7 @@ class ZopeStarterTestCase(test_logger.LoggingTestBase):
f
.
close
()
f
.
close
()
configure
(
fname
)
configure
(
fname
)
new_config
=
getConfiguration
()
new_config
=
getConfiguration
()
self
.
failUnless
Equal
(
new_config
.
zserver_threads
,
100
)
self
.
assert
Equal
(
new_config
.
zserver_threads
,
100
)
finally
:
finally
:
sys
.
argv
=
old_argv
sys
.
argv
=
old_argv
try
:
try
:
...
...
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