Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
ZODB
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
Nicolas Wavrant
ZODB
Commits
9509d1a6
Commit
9509d1a6
authored
Feb 15, 2013
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Py3k namnyism: 'assert_' -> 'assertTrue'.
parent
67f90d1b
Changes
23
Hide whitespace changes
Inline
Side-by-side
Showing
23 changed files
with
140 additions
and
135 deletions
+140
-135
src/ZODB/tests/BasicStorage.py
src/ZODB/tests/BasicStorage.py
+7
-6
src/ZODB/tests/ConflictResolution.py
src/ZODB/tests/ConflictResolution.py
+1
-1
src/ZODB/tests/IteratorStorage.py
src/ZODB/tests/IteratorStorage.py
+1
-1
src/ZODB/tests/ReadOnlyStorage.py
src/ZODB/tests/ReadOnlyStorage.py
+1
-1
src/ZODB/tests/RecoveryStorage.py
src/ZODB/tests/RecoveryStorage.py
+4
-4
src/ZODB/tests/RevisionStorage.py
src/ZODB/tests/RevisionStorage.py
+2
-2
src/ZODB/tests/StorageTestBase.py
src/ZODB/tests/StorageTestBase.py
+1
-1
src/ZODB/tests/TransactionalUndoStorage.py
src/ZODB/tests/TransactionalUndoStorage.py
+7
-5
src/ZODB/tests/testActivityMonitor.py
src/ZODB/tests/testActivityMonitor.py
+8
-8
src/ZODB/tests/testCache.py
src/ZODB/tests/testCache.py
+5
-5
src/ZODB/tests/testConnection.py
src/ZODB/tests/testConnection.py
+33
-32
src/ZODB/tests/testDB.py
src/ZODB/tests/testDB.py
+1
-1
src/ZODB/tests/testDemoStorage.py
src/ZODB/tests/testDemoStorage.py
+3
-3
src/ZODB/tests/testFileStorage.py
src/ZODB/tests/testFileStorage.py
+8
-8
src/ZODB/tests/testMVCCMappingStorage.py
src/ZODB/tests/testMVCCMappingStorage.py
+18
-18
src/ZODB/tests/testPersistentList.py
src/ZODB/tests/testPersistentList.py
+1
-1
src/ZODB/tests/testPersistentMapping.py
src/ZODB/tests/testPersistentMapping.py
+7
-7
src/ZODB/tests/testRecover.py
src/ZODB/tests/testRecover.py
+5
-5
src/ZODB/tests/testSerialize.py
src/ZODB/tests/testSerialize.py
+10
-9
src/ZODB/tests/testUtils.py
src/ZODB/tests/testUtils.py
+1
-1
src/ZODB/tests/testZODB.py
src/ZODB/tests/testZODB.py
+8
-8
src/ZODB/tests/testblob.py
src/ZODB/tests/testblob.py
+2
-2
src/ZODB/tests/testfsIndex.py
src/ZODB/tests/testfsIndex.py
+6
-6
No files found.
src/ZODB/tests/BasicStorage.py
View file @
9509d1a6
...
...
@@ -169,7 +169,7 @@ class BasicStorage:
# of this number
self
.
_dostore
(
data
=
MinPO
(
22
))
self
.
_dostore
(
data
=
MinPO
(
23
))
self
.
assert
_
(
len
(
self
.
_storage
)
in
[
0
,
2
])
self
.
assert
True
(
len
(
self
.
_storage
)
in
[
0
,
2
])
def
checkGetSize
(
self
):
self
.
_dostore
(
data
=
MinPO
(
25
))
...
...
@@ -233,10 +233,10 @@ class BasicStorage:
self
.
_storage
.
checkCurrentSerialInTransaction
(
oid
,
tid
,
t
)
self
.
_storage
.
tpc_vote
(
t
)
except
POSException
.
ReadConflictError
as
v
:
self
.
assert
_
(
v
.
oid
)
==
oid
self
.
assert
_
(
v
.
serials
==
(
tid2
,
tid
))
self
.
assert
True
(
v
.
oid
)
==
oid
self
.
assert
True
(
v
.
serials
==
(
tid2
,
tid
))
else
:
if
0
:
self
.
assert
_
(
False
,
"No conflict error"
)
if
0
:
self
.
assert
True
(
False
,
"No conflict error"
)
self
.
_storage
.
tpc_abort
(
t
)
...
...
@@ -269,7 +269,7 @@ class BasicStorage:
thread
.
join
(
33
)
tid3
=
self
.
_storage
.
load
(
oid
)[
1
]
self
.
assert
_
(
tid3
>
self
.
_storage
.
load
(
b'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
xf3
'
)[
1
])
self
.
assert
True
(
tid3
>
self
.
_storage
.
load
(
b'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
xf3
'
)[
1
])
#----------------------------------------------------------------------
# non-stale competing trans after checkCurrentSerialInTransaction
...
...
@@ -295,7 +295,8 @@ class BasicStorage:
self
.
_storage
.
tpc_finish
(
t
)
thread
.
join
()
tid4
=
self
.
_storage
.
load
(
oid
)[
1
]
self
.
assert_
(
tid4
>
self
.
_storage
.
load
(
b'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
xf4
'
)[
1
])
self
.
assertTrue
(
tid4
>
self
.
_storage
.
load
(
b'
\
0
\
0
\
0
\
0
\
0
\
0
\
0
\
xf4
'
)[
1
])
def
check_tid_ordering_w_commit
(
self
):
...
...
src/ZODB/tests/ConflictResolution.py
View file @
9509d1a6
...
...
@@ -92,7 +92,7 @@ class ConflictResolvingStorage:
try
:
self
.
_dostoreNP
(
oid
,
revid
=
revid1
,
data
=
zodb_pickle
(
obj
))
except
ConflictError
as
err
:
self
.
assert
_
(
"PCounter2"
in
str
(
err
))
self
.
assert
True
(
"PCounter2"
in
str
(
err
))
else
:
self
.
fail
(
"Expected ConflictError"
)
...
...
src/ZODB/tests/IteratorStorage.py
View file @
9509d1a6
...
...
@@ -233,7 +233,7 @@ class IteratorDeepCompare:
storage2
.
loadBlob
,
rec1
.
oid
,
rec1
.
tid
)
else
:
fn2
=
storage2
.
loadBlob
(
rec1
.
oid
,
rec1
.
tid
)
self
.
assert
_
(
fn1
!=
fn2
)
self
.
assert
True
(
fn1
!=
fn2
)
eq
(
open
(
fn1
,
'rb'
).
read
(),
open
(
fn2
,
'rb'
).
read
())
# Make sure there are no more records left in rec1 and rec2,
...
...
src/ZODB/tests/ReadOnlyStorage.py
View file @
9509d1a6
...
...
@@ -27,7 +27,7 @@ class ReadOnlyStorage:
def
_make_readonly
(
self
):
self
.
_storage
.
close
()
self
.
open
(
read_only
=
True
)
self
.
assert
_
(
self
.
_storage
.
isReadOnly
())
self
.
assert
True
(
self
.
_storage
.
isReadOnly
())
def
checkReadMethods
(
self
):
self
.
_create_data
()
...
...
src/ZODB/tests/RecoveryStorage.py
View file @
9509d1a6
...
...
@@ -160,8 +160,8 @@ class RecoveryStorage(IteratorDeepCompare):
# transaction. Without the patch, the second assert failed
# (it claimed it couldn't find a data record for obj2) on my
# box, but other failure modes were possible.
self
.
assert
_
(
self
.
_storage
.
_data_find
(
pos
,
obj1_oid
,
''
)
>
0
)
self
.
assert
_
(
self
.
_storage
.
_data_find
(
pos
,
obj2_oid
,
''
)
>
0
)
self
.
assert
True
(
self
.
_storage
.
_data_find
(
pos
,
obj1_oid
,
''
)
>
0
)
self
.
assert
True
(
self
.
_storage
.
_data_find
(
pos
,
obj2_oid
,
''
)
>
0
)
# The offset of the next ("redo") transaction.
pos
=
self
.
_storage
.
getSize
()
...
...
@@ -182,8 +182,8 @@ class RecoveryStorage(IteratorDeepCompare):
if
is_filestorage
:
# Again _data_find should find both objects in this txn, and
# again the second assert failed on my box.
self
.
assert
_
(
self
.
_storage
.
_data_find
(
pos
,
obj1_oid
,
''
)
>
0
)
self
.
assert
_
(
self
.
_storage
.
_data_find
(
pos
,
obj2_oid
,
''
)
>
0
)
self
.
assert
True
(
self
.
_storage
.
_data_find
(
pos
,
obj1_oid
,
''
)
>
0
)
self
.
assert
True
(
self
.
_storage
.
_data_find
(
pos
,
obj2_oid
,
''
)
>
0
)
# Indirectly provoke .restore(). .restore in turn indirectly
# provokes _data_find too, but not usefully for the purposes of
...
...
src/ZODB/tests/RevisionStorage.py
View file @
9509d1a6
...
...
@@ -62,7 +62,7 @@ class RevisionStorage:
assert
prev
<
middle
<
cur
# else the snooze() trick failed
prev
=
cur
t
=
self
.
_storage
.
loadBefore
(
oid
,
p64
(
middle
))
self
.
assert
_
(
t
is
not
None
)
self
.
assert
True
(
t
is
not
None
)
data
,
start
,
end
=
t
self
.
assertEqual
(
revs
[
i
-
1
][
0
],
data
)
self
.
assertEqual
(
tid
,
end
)
...
...
@@ -131,7 +131,7 @@ class RevisionStorage:
self
.
assertEqual
(
data
,
t
[
0
])
self
.
assertEqual
(
tid
,
t
[
1
])
if
prev_tid
:
self
.
assert
_
(
prev_tid
<
t
[
1
])
self
.
assert
True
(
prev_tid
<
t
[
1
])
prev_tid
=
t
[
1
]
if
i
<
3
:
self
.
assertEqual
(
revs
[
i
+
1
][
1
],
t
[
2
])
...
...
src/ZODB/tests/StorageTestBase.py
View file @
9509d1a6
...
...
@@ -230,5 +230,5 @@ class StorageTestBase(ZODB.tests.util.TestCase):
oids
.
extend
(
oid
for
(
oid
,
_
)
in
vote_result
or
())
self
.
assertEqual
(
len
(
oids
),
len
(
expected_oids
),
repr
(
oids
))
for
oid
in
expected_oids
:
self
.
assert
_
(
oid
in
oids
)
self
.
assert
True
(
oid
in
oids
)
return
self
.
_storage
.
lastTransaction
()
src/ZODB/tests/TransactionalUndoStorage.py
View file @
9509d1a6
...
...
@@ -376,7 +376,8 @@ class TransactionalUndoStorage:
info
=
self
.
_storage
.
undoInfo
()
tid
=
info
[
1
][
'id'
]
t
=
Transaction
()
self
.
assertRaises
(
POSException
.
UndoError
,
self
.
_begin_undos_vote
,
t
,
tid
)
self
.
assertRaises
(
POSException
.
UndoError
,
self
.
_begin_undos_vote
,
t
,
tid
)
self
.
_storage
.
tpc_abort
(
t
)
# Now have more fun: object1 and object2 are in the same transaction,
# which we'll try to undo to, but one of them has since modified in
...
...
@@ -412,7 +413,8 @@ class TransactionalUndoStorage:
info
=
self
.
_storage
.
undoInfo
()
tid
=
info
[
1
][
'id'
]
t
=
Transaction
()
self
.
assertRaises
(
POSException
.
UndoError
,
self
.
_begin_undos_vote
,
t
,
tid
)
self
.
assertRaises
(
POSException
.
UndoError
,
self
.
_begin_undos_vote
,
t
,
tid
)
self
.
_storage
.
tpc_abort
(
t
)
self
.
_iterate
()
...
...
@@ -545,7 +547,7 @@ class TransactionalUndoStorage:
root
.
_p_deactivate
()
cn
.
sync
()
self
.
assert
_
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key2"
]))
self
.
assert
True
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key2"
]))
L
=
db
.
undoInfo
()
db
.
undo
(
L
[
0
][
"id"
])
...
...
@@ -557,14 +559,14 @@ class TransactionalUndoStorage:
root
.
_p_deactivate
()
cn
.
sync
()
self
.
assert
_
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key1"
,
"key2"
]))
self
.
assert
True
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key1"
,
"key2"
]))
for
t
in
pack_times
:
self
.
_storage
.
pack
(
t
,
referencesf
)
root
.
_p_deactivate
()
cn
.
sync
()
self
.
assert
_
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key1"
,
"key2"
]))
self
.
assert
True
(
listeq
(
root
.
keys
(),
[
"key0"
,
"key1"
,
"key2"
]))
for
i
in
range
(
3
):
obj
=
root
[
"key%d"
%
i
]
self
.
assertEqual
(
obj
.
value
,
i
)
...
...
src/ZODB/tests/testActivityMonitor.py
View file @
9509d1a6
...
...
@@ -60,7 +60,7 @@ class Tests(unittest.TestCase):
time
.
sleep
(
0.2
)
c
.
_transferred
(
3
,
7
)
am
.
closedConnection
(
c
)
self
.
assert
_
(
len
(
am
.
log
)
<=
1
)
self
.
assert
True
(
len
(
am
.
log
)
<=
1
)
def
testSetHistoryLength
(
self
):
am
=
ActivityMonitor
(
history_length
=
3600
)
...
...
@@ -73,7 +73,7 @@ class Tests(unittest.TestCase):
self
.
assertEqual
(
len
(
am
.
log
),
2
)
am
.
setHistoryLength
(
0.1
)
self
.
assertEqual
(
am
.
getHistoryLength
(),
0.1
)
self
.
assert
_
(
len
(
am
.
log
)
<=
1
)
self
.
assert
True
(
len
(
am
.
log
)
<=
1
)
def
testActivityAnalysis
(
self
):
am
=
ActivityMonitor
(
history_length
=
3600
)
...
...
@@ -88,16 +88,16 @@ class Tests(unittest.TestCase):
div
=
res
[
n
]
self
.
assertEqual
(
div
[
'stores'
],
0
)
self
.
assertEqual
(
div
[
'loads'
],
0
)
self
.
assert
_
(
div
[
'start'
]
>
0
)
self
.
assert
_
(
div
[
'start'
]
>=
lastend
)
self
.
assert
_
(
div
[
'start'
]
<
div
[
'end'
])
self
.
assert
True
(
div
[
'start'
]
>
0
)
self
.
assert
True
(
div
[
'start'
]
>=
lastend
)
self
.
assert
True
(
div
[
'start'
]
<
div
[
'end'
])
lastend
=
div
[
'end'
]
div
=
res
[
9
]
self
.
assertEqual
(
div
[
'stores'
],
9
)
self
.
assertEqual
(
div
[
'loads'
],
4
)
self
.
assert
_
(
div
[
'start'
]
>
0
)
self
.
assert
_
(
div
[
'start'
]
>=
lastend
)
self
.
assert
_
(
div
[
'start'
]
<
div
[
'end'
])
self
.
assert
True
(
div
[
'start'
]
>
0
)
self
.
assert
True
(
div
[
'start'
]
>=
lastend
)
self
.
assert
True
(
div
[
'start'
]
<
div
[
'end'
])
def
test_suite
():
...
...
src/ZODB/tests/testCache.py
View file @
9509d1a6
...
...
@@ -105,7 +105,7 @@ class DBMethods(CacheTestBase):
expected
=
[
'conn_no'
,
'id'
,
'oid'
,
'rc'
,
'klass'
,
'state'
]
for
dict
in
self
.
db
.
cacheExtremeDetail
():
for
k
,
v
in
dict
.
items
():
self
.
assert
_
(
k
in
expected
)
self
.
assert
True
(
k
in
expected
)
# TODO: not really sure how to do a black box test of the cache.
# Should the full sweep and minimize calls always remove things?
...
...
@@ -114,13 +114,13 @@ class DBMethods(CacheTestBase):
old_size
=
self
.
db
.
cacheSize
()
self
.
db
.
cacheFullSweep
()
new_size
=
self
.
db
.
cacheSize
()
self
.
assert
_
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
self
.
assert
True
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
def
testMinimize
(
self
):
old_size
=
self
.
db
.
cacheSize
()
self
.
db
.
cacheMinimize
()
new_size
=
self
.
db
.
cacheSize
()
self
.
assert
_
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
self
.
assert
True
(
new_size
<
old_size
,
"%s < %s"
%
(
old_size
,
new_size
))
def
testMinimizeTerminates
(
self
):
# This is tricky. cPickleCache had a case where it could get into
...
...
@@ -295,11 +295,11 @@ class LRUCacheTests(CacheTestBase):
if
details
[
'klass'
].
endswith
(
'PersistentMapping'
):
self
.
assertEqual
(
details
[
'state'
],
None
)
else
:
self
.
assert
_
(
details
[
'klass'
].
endswith
(
'MinPO'
))
self
.
assert
True
(
details
[
'klass'
].
endswith
(
'MinPO'
))
self
.
assertEqual
(
details
[
'state'
],
0
)
# The cache should never hold an unreferenced ghost.
if
details
[
'state'
]
is
None
:
# i.e., it's a ghost
self
.
assert
_
(
details
[
'rc'
]
>
0
)
self
.
assert
True
(
details
[
'rc'
]
>
0
)
class
StubDataManager
:
def
setklassstate
(
self
,
object
):
...
...
src/ZODB/tests/testConnection.py
View file @
9509d1a6
...
...
@@ -54,12 +54,12 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
def
check_add
(
self
):
from
ZODB.POSException
import
InvalidObjectReference
obj
=
StubObject
()
self
.
assert
_
(
obj
.
_p_oid
is
None
)
self
.
assert
_
(
obj
.
_p_jar
is
None
)
self
.
assert
True
(
obj
.
_p_oid
is
None
)
self
.
assert
True
(
obj
.
_p_jar
is
None
)
self
.
datamgr
.
add
(
obj
)
self
.
assert
_
(
obj
.
_p_oid
is
not
None
)
self
.
assert
_
(
obj
.
_p_jar
is
self
.
datamgr
)
self
.
assert
_
(
self
.
datamgr
.
get
(
obj
.
_p_oid
)
is
obj
)
self
.
assert
True
(
obj
.
_p_oid
is
not
None
)
self
.
assert
True
(
obj
.
_p_jar
is
self
.
datamgr
)
self
.
assert
True
(
self
.
datamgr
.
get
(
obj
.
_p_oid
)
is
obj
)
# Only first-class persistent objects may be added.
self
.
assertRaises
(
TypeError
,
self
.
datamgr
.
add
,
object
())
...
...
@@ -82,8 +82,8 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
self
.
datamgr
.
add
(
obj
)
oid
=
obj
.
_p_oid
self
.
datamgr
.
abort
(
self
.
transaction
)
self
.
assert
_
(
obj
.
_p_oid
is
None
)
self
.
assert
_
(
obj
.
_p_jar
is
None
)
self
.
assert
True
(
obj
.
_p_oid
is
None
)
self
.
assert
True
(
obj
.
_p_jar
is
None
)
self
.
assertRaises
(
KeyError
,
self
.
datamgr
.
get
,
oid
)
def
checkResetOnTpcAbort
(
self
):
...
...
@@ -97,8 +97,8 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
# Let's pretend something bad happens here.
# Call tpc_abort, clearing everything.
self
.
datamgr
.
tpc_abort
(
self
.
transaction
)
self
.
assert
_
(
obj
.
_p_oid
is
None
)
self
.
assert
_
(
obj
.
_p_jar
is
None
)
self
.
assert
True
(
obj
.
_p_oid
is
None
)
self
.
assert
True
(
obj
.
_p_jar
is
None
)
self
.
assertRaises
(
KeyError
,
self
.
datamgr
.
get
,
oid
)
def
checkTpcAbortAfterCommit
(
self
):
...
...
@@ -109,8 +109,8 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
self
.
datamgr
.
commit
(
self
.
transaction
)
# Let's pretend something bad happened here.
self
.
datamgr
.
tpc_abort
(
self
.
transaction
)
self
.
assert
_
(
obj
.
_p_oid
is
None
)
self
.
assert
_
(
obj
.
_p_jar
is
None
)
self
.
assert
True
(
obj
.
_p_oid
is
None
)
self
.
assert
True
(
obj
.
_p_jar
is
None
)
self
.
assertRaises
(
KeyError
,
self
.
datamgr
.
get
,
oid
)
self
.
assertEquals
(
self
.
db
.
storage
.
_stored
,
[
oid
])
...
...
@@ -121,11 +121,11 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
self
.
datamgr
.
tpc_begin
(
self
.
transaction
)
self
.
datamgr
.
commit
(
self
.
transaction
)
self
.
datamgr
.
tpc_finish
(
self
.
transaction
)
self
.
assert
_
(
obj
.
_p_oid
is
oid
)
self
.
assert
_
(
obj
.
_p_jar
is
self
.
datamgr
)
self
.
assert
True
(
obj
.
_p_oid
is
oid
)
self
.
assert
True
(
obj
.
_p_jar
is
self
.
datamgr
)
# This next assert
_
is covered by an assert in tpc_finish.
##self.assert
_
(not self.datamgr._added)
# This next assert
True
is covered by an assert in tpc_finish.
##self.assert
True
(not self.datamgr._added)
self
.
assertEquals
(
self
.
db
.
storage
.
_stored
,
[
oid
])
self
.
assertEquals
(
self
.
db
.
storage
.
_finished
,
[
oid
])
...
...
@@ -140,11 +140,12 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
self
.
datamgr
.
commit
(
self
.
transaction
)
self
.
datamgr
.
tpc_finish
(
self
.
transaction
)
storage
=
self
.
db
.
storage
self
.
assert
_
(
obj
.
_p_oid
in
storage
.
_stored
,
"object was not stored"
)
self
.
assert
_
(
subobj
.
_p_oid
in
storage
.
_stored
,
self
.
assert
True
(
obj
.
_p_oid
in
storage
.
_stored
,
"object was not stored"
)
self
.
assert
True
(
subobj
.
_p_oid
in
storage
.
_stored
,
"subobject was not stored"
)
self
.
assert_
(
member
.
_p_oid
in
storage
.
_stored
,
"member was not stored"
)
self
.
assert_
(
self
.
datamgr
.
_added_during_commit
is
None
)
self
.
assertTrue
(
member
.
_p_oid
in
storage
.
_stored
,
"member was not stored"
)
self
.
assertTrue
(
self
.
datamgr
.
_added_during_commit
is
None
)
def
checkUnusedAddWorks
(
self
):
# When an object is added, but not committed, it shouldn't be stored,
...
...
@@ -153,7 +154,7 @@ class ConnectionDotAdd(ZODB.tests.util.TestCase):
self
.
datamgr
.
add
(
obj
)
self
.
datamgr
.
tpc_begin
(
self
.
transaction
)
self
.
datamgr
.
tpc_finish
(
self
.
transaction
)
self
.
assert
_
(
obj
.
_p_oid
not
in
self
.
datamgr
.
_storage
.
_stored
)
self
.
assert
True
(
obj
.
_p_oid
not
in
self
.
datamgr
.
_storage
.
_stored
)
def
check__resetCacheResetsReader
(
self
):
# https://bugs.launchpad.net/zodb/+bug/142667
...
...
@@ -1043,13 +1044,13 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
obj
,
cache
=
self
.
obj
,
self
.
conn
.
_cache
# we have just written "obj". Its size should not be zero
size
,
cache_size
=
obj
.
_p_estimated_size
,
cache
.
total_estimated_size
self
.
assert
_
(
size
>
0
)
self
.
assert
_
(
cache_size
>
size
)
self
.
assert
True
(
size
>
0
)
self
.
assert
True
(
cache_size
>
size
)
# increase the size, write again and check that the size changed
obj
.
setValueWithSize
(
1000
)
transaction
.
commit
()
new_size
=
obj
.
_p_estimated_size
self
.
assert
_
(
new_size
>
size
)
self
.
assert
True
(
new_size
>
size
)
self
.
assertEqual
(
cache
.
total_estimated_size
,
cache_size
+
new_size
-
size
)
...
...
@@ -1061,7 +1062,7 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
obj
.
setValueWithSize
(
1000
)
transaction
.
savepoint
()
new_size
=
obj
.
_p_estimated_size
self
.
assert
_
(
new_size
>
size
)
self
.
assert
True
(
new_size
>
size
)
self
.
assertEqual
(
cache
.
total_estimated_size
,
cache_size
+
new_size
-
size
)
...
...
@@ -1074,7 +1075,7 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
cache_size
=
cache
.
total_estimated_size
obj
.
value
size
=
obj
.
_p_estimated_size
self
.
assert
_
(
size
>
0
)
self
.
assert
True
(
size
>
0
)
self
.
assertEqual
(
cache
.
total_estimated_size
,
cache_size
+
size
)
# we test here as well that the deactivation works reduced the cache
# size
...
...
@@ -1124,11 +1125,11 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
# verify the change worked as expected
self
.
assertEqual
(
cache
.
cache_size_bytes
,
1
)
# verify our entrance assumption is fullfilled
self
.
assert
_
(
cache
.
total_estimated_size
>
1
)
self
.
assert
True
(
cache
.
total_estimated_size
>
1
)
conn
.
cacheGC
()
self
.
assert
_
(
cache
.
total_estimated_size
<=
1
)
self
.
assert
True
(
cache
.
total_estimated_size
<=
1
)
# sanity check
self
.
assert
_
(
cache
.
total_estimated_size
>=
0
)
self
.
assert
True
(
cache
.
total_estimated_size
>=
0
)
def
test_cache_garbage_collection_shrinking_object
(
self
):
db
=
self
.
db
...
...
@@ -1138,18 +1139,18 @@ class EstimatedSizeTests(ZODB.tests.util.TestCase):
# verify the change worked as expected
self
.
assertEqual
(
cache
.
cache_size_bytes
,
1000
)
# verify our entrance assumption is fullfilled
self
.
assert
_
(
cache
.
total_estimated_size
>
1
)
self
.
assert
True
(
cache
.
total_estimated_size
>
1
)
# give the objects some size
obj
.
setValueWithSize
(
500
)
transaction
.
savepoint
()
self
.
assert
_
(
cache
.
total_estimated_size
>
500
)
self
.
assert
True
(
cache
.
total_estimated_size
>
500
)
# make the object smaller
obj
.
setValueWithSize
(
100
)
transaction
.
savepoint
()
# make sure there was no overflow
self
.
assert
_
(
cache
.
total_estimated_size
!=
0
)
self
.
assert
True
(
cache
.
total_estimated_size
!=
0
)
# the size is not larger than the allowed maximum
self
.
assert
_
(
cache
.
total_estimated_size
<=
1000
)
self
.
assert
True
(
cache
.
total_estimated_size
<=
1000
)
# ---- stubs
...
...
src/ZODB/tests/testDB.py
View file @
9509d1a6
...
...
@@ -73,7 +73,7 @@ class DBTests(ZODB.tests.util.TestCase):
# have tests of referencesf.
import
ZODB.serialize
self
.
assert
_
(
self
.
db
.
references
is
ZODB
.
serialize
.
referencesf
)
self
.
assert
True
(
self
.
db
.
references
is
ZODB
.
serialize
.
referencesf
)
def
test_invalidateCache
():
...
...
src/ZODB/tests/testDemoStorage.py
View file @
9509d1a6
...
...
@@ -71,16 +71,16 @@ class DemoStorageTests(
def
checkLengthAndBool
(
self
):
self
.
assertEqual
(
len
(
self
.
_storage
),
0
)
self
.
assert
_
(
not
self
.
_storage
)
self
.
assert
True
(
not
self
.
_storage
)
db
=
DB
(
self
.
_storage
)
# creates object 0. :)
self
.
assertEqual
(
len
(
self
.
_storage
),
1
)
self
.
assert
_
(
self
.
_storage
)
self
.
assert
True
(
self
.
_storage
)
conn
=
db
.
open
()
for
i
in
range
(
10
):
conn
.
root
()[
i
]
=
conn
.
root
().
__class__
()
transaction
.
commit
()
self
.
assertEqual
(
len
(
self
.
_storage
),
11
)
self
.
assert
_
(
self
.
_storage
)
self
.
assert
True
(
self
.
_storage
)
def
checkLoadBeforeUndo
(
self
):
pass
# we don't support undo yet
...
...
src/ZODB/tests/testFileStorage.py
View file @
9509d1a6
...
...
@@ -113,13 +113,13 @@ class FileStorageTests(
# Convert it to a dict.
old_index
=
self
.
convert_index_to_dict
()
self
.
assert
_
(
isinstance
(
old_index
,
fsIndex
))
self
.
assert
True
(
isinstance
(
old_index
,
fsIndex
))
new_index
=
self
.
convert_index_to_dict
()
self
.
assert
_
(
isinstance
(
new_index
,
dict
))
self
.
assert
True
(
isinstance
(
new_index
,
dict
))
# Verify it's converted to fsIndex in memory upon open.
self
.
open
(
read_only
=
read_only
)
self
.
assert
_
(
isinstance
(
self
.
_storage
.
_index
,
fsIndex
))
self
.
assert
True
(
isinstance
(
self
.
_storage
.
_index
,
fsIndex
))
# Verify it has the right content.
newindex_as_dict
=
dict
(
self
.
_storage
.
_index
)
...
...
@@ -129,9 +129,9 @@ class FileStorageTests(
self
.
_storage
.
close
()
current_index
=
self
.
convert_index_to_dict
()
if
read_only
:
self
.
assert
_
(
isinstance
(
current_index
,
dict
))
self
.
assert
True
(
isinstance
(
current_index
,
dict
))
else
:
self
.
assert
_
(
isinstance
(
current_index
,
fsIndex
))
self
.
assert
True
(
isinstance
(
current_index
,
fsIndex
))
def
check_conversion_to_fsIndex_readonly
(
self
):
# Same thing, but the disk .index should continue to hold a
...
...
@@ -161,8 +161,8 @@ class FileStorageTests(
# Verify it's converted to fsIndex in memory upon open.
self
.
open
()
self
.
assert
_
(
isinstance
(
self
.
_storage
.
_index
,
fsIndex
))
self
.
assert
_
(
isinstance
(
self
.
_storage
.
_index
.
_data
,
OOBTree
))
self
.
assert
True
(
isinstance
(
self
.
_storage
.
_index
,
fsIndex
))
self
.
assert
True
(
isinstance
(
self
.
_storage
.
_index
.
_data
,
OOBTree
))
# Verify it has the right content.
new_data_dict
=
dict
(
self
.
_storage
.
_index
.
_data
)
...
...
@@ -259,7 +259,7 @@ class FileStorageTests(
try
:
self
.
_storage
.
pack
(
time
.
time
(),
referencesf
)
except
CorruptedError
as
detail
:
self
.
assert
_
(
"redundant transaction length does not match "
self
.
assert
True
(
"redundant transaction length does not match "
"initial transaction length"
in
str
(
detail
))
else
:
self
.
fail
(
"expected CorruptedError"
)
...
...
src/ZODB/tests/testMVCCMappingStorage.py
View file @
9509d1a6
...
...
@@ -44,14 +44,14 @@ class MVCCTests:
r1
[
'myobj'
]
=
'yes'
c2
=
db
.
open
(
transaction
.
TransactionManager
())
r2
=
c2
.
root
()
self
.
assert
_
(
'myobj'
not
in
r2
)
self
.
assert
True
(
'myobj'
not
in
r2
)
c1
.
transaction_manager
.
commit
()
self
.
assert
_
(
'myobj'
not
in
r2
)
self
.
assert
True
(
'myobj'
not
in
r2
)
c2
.
sync
()
self
.
assert
_
(
'myobj'
in
r2
)
self
.
assert
_
(
r2
[
'myobj'
]
==
'yes'
)
self
.
assert
True
(
'myobj'
in
r2
)
self
.
assert
True
(
r2
[
'myobj'
]
==
'yes'
)
finally
:
db
.
close
()
...
...
@@ -82,18 +82,18 @@ class MVCCTests:
# The second connection will now load root['alpha'], but due to
# MVCC, it should continue to see the old state.
self
.
assert
_
(
r2
[
'alpha'
].
_p_changed
is
None
)
# A ghost
self
.
assert
_
(
not
r2
[
'alpha'
])
self
.
assert
_
(
r2
[
'alpha'
].
_p_changed
==
0
)
self
.
assert
True
(
r2
[
'alpha'
].
_p_changed
is
None
)
# A ghost
self
.
assert
True
(
not
r2
[
'alpha'
])
self
.
assert
True
(
r2
[
'alpha'
].
_p_changed
==
0
)
# make root['alpha'] visible to the second connection
c2
.
sync
()
# Now it should be in sync
self
.
assert
_
(
r2
[
'alpha'
].
_p_changed
is
None
)
# A ghost
self
.
assert
_
(
r2
[
'alpha'
])
self
.
assert
_
(
r2
[
'alpha'
].
_p_changed
==
0
)
self
.
assert
_
(
r2
[
'alpha'
][
'beta'
]
==
'yes'
)
self
.
assert
True
(
r2
[
'alpha'
].
_p_changed
is
None
)
# A ghost
self
.
assert
True
(
r2
[
'alpha'
])
self
.
assert
True
(
r2
[
'alpha'
].
_p_changed
==
0
)
self
.
assert
True
(
r2
[
'alpha'
][
'beta'
]
==
'yes'
)
# Repeat the test with root['gamma']
r1
[
'gamma'
][
'delta'
]
=
'yes'
...
...
@@ -108,18 +108,18 @@ class MVCCTests:
# The second connection will now load root[3], but due to MVCC,
# it should continue to see the old state.
self
.
assert
_
(
r2
[
'gamma'
].
_p_changed
is
None
)
# A ghost
self
.
assert
_
(
not
r2
[
'gamma'
])
self
.
assert
_
(
r2
[
'gamma'
].
_p_changed
==
0
)
self
.
assert
True
(
r2
[
'gamma'
].
_p_changed
is
None
)
# A ghost
self
.
assert
True
(
not
r2
[
'gamma'
])
self
.
assert
True
(
r2
[
'gamma'
].
_p_changed
==
0
)
# make root[3] visible to the second connection
c2
.
sync
()
# Now it should be in sync
self
.
assert
_
(
r2
[
'gamma'
].
_p_changed
is
None
)
# A ghost
self
.
assert
_
(
r2
[
'gamma'
])
self
.
assert
_
(
r2
[
'gamma'
].
_p_changed
==
0
)
self
.
assert
_
(
r2
[
'gamma'
][
'delta'
]
==
'yes'
)
self
.
assert
True
(
r2
[
'gamma'
].
_p_changed
is
None
)
# A ghost
self
.
assert
True
(
r2
[
'gamma'
])
self
.
assert
True
(
r2
[
'gamma'
].
_p_changed
==
0
)
self
.
assert
True
(
r2
[
'gamma'
][
'delta'
]
==
'yes'
)
finally
:
db
.
close
()
...
...
src/ZODB/tests/testPersistentList.py
View file @
9509d1a6
...
...
@@ -216,7 +216,7 @@ class TestPList(unittest.TestCase):
def
checkBackwardCompat
(
self
):
# Verify that the sanest of the ZODB 3.2 dotted paths still works.
from
ZODB.PersistentList
import
PersistentList
as
oldPath
self
.
assert
_
(
oldPath
is
PersistentList
)
self
.
assert
True
(
oldPath
is
PersistentList
)
def
test_suite
():
return
unittest
.
makeSuite
(
TestPList
,
'check'
)
...
...
src/ZODB/tests/testPersistentMapping.py
View file @
9509d1a6
...
...
@@ -69,8 +69,8 @@ class PMTests(unittest.TestCase):
# If the root can be loaded successfully, we should be okay.
r
=
db
.
open
().
root
()
# But make sure it looks like a new mapping
self
.
assert
_
(
hasattr
(
r
,
'data'
))
self
.
assert
_
(
not
hasattr
(
r
,
'_container'
))
self
.
assert
True
(
hasattr
(
r
,
'data'
))
self
.
assert
True
(
not
hasattr
(
r
,
'_container'
))
# TODO: This test fails in ZODB 3.3a1. It's making some assumption(s)
# about pickles that aren't true. Hard to say when it stopped working,
...
...
@@ -97,15 +97,15 @@ class PMTests(unittest.TestCase):
state
=
u
.
load
()
inst
.
__setstate__
(
state
)
self
.
assert
_
(
hasattr
(
inst
,
'_container'
))
self
.
assert
_
(
not
hasattr
(
inst
,
'data'
))
self
.
assert
True
(
hasattr
(
inst
,
'_container'
))
self
.
assert
True
(
not
hasattr
(
inst
,
'data'
))
def
checkBackwardCompat
(
self
):
# Verify that the sanest of the ZODB 3.2 dotted paths still works.
from
persistent.mapping
import
PersistentMapping
as
newPath
from
ZODB.PersistentMapping
import
PersistentMapping
as
oldPath
self
.
assert
_
(
oldPath
is
newPath
)
self
.
assert
True
(
oldPath
is
newPath
)
def
checkBasicOps
(
self
):
from
persistent.mapping
import
PersistentMapping
...
...
@@ -113,7 +113,7 @@ class PMTests(unittest.TestCase):
m
[
'name'
]
=
'bob'
self
.
assertEqual
(
m
[
'name'
],
"bob"
)
self
.
assertEqual
(
m
.
get
(
'name'
,
42
),
"bob"
)
self
.
assert
_
(
'name'
in
m
)
self
.
assert
True
(
'name'
in
m
)
try
:
m
[
'fred'
]
...
...
@@ -121,7 +121,7 @@ class PMTests(unittest.TestCase):
pass
else
:
self
.
fail
(
"expected KeyError"
)
self
.
assert
_
(
'fred'
not
in
m
)
self
.
assert
True
(
'fred'
not
in
m
)
self
.
assertEqual
(
m
.
get
(
'fred'
),
None
)
self
.
assertEqual
(
m
.
get
(
'fred'
,
42
),
42
)
...
...
src/ZODB/tests/testRecover.py
View file @
9509d1a6
...
...
@@ -102,8 +102,8 @@ class RecoverTest(ZODB.tests.util.TestCase):
# fact not damaged.
def
testNoDamage
(
self
):
output
=
self
.
recover
()
self
.
assert
_
(
'error'
not
in
output
,
output
)
self
.
assert
_
(
'
\
n
0 bytes removed during recovery'
in
output
,
output
)
self
.
assert
True
(
'error'
not
in
output
,
output
)
self
.
assert
True
(
'
\
n
0 bytes removed during recovery'
in
output
,
output
)
# Verify that the recovered database is identical to the original.
before
=
open
(
self
.
path
,
'rb'
)
...
...
@@ -121,7 +121,7 @@ class RecoverTest(ZODB.tests.util.TestCase):
for
i
in
range
(
self
.
ITERATIONS
):
self
.
damage
(
1
,
1024
)
output
=
self
.
recover
()
self
.
assert
_
(
'error'
in
output
,
output
)
self
.
assert
True
(
'error'
in
output
,
output
)
self
.
recovered
=
FileStorage
(
self
.
dest
)
self
.
recovered
.
close
()
os
.
remove
(
self
.
path
)
...
...
@@ -131,7 +131,7 @@ class RecoverTest(ZODB.tests.util.TestCase):
for
i
in
range
(
self
.
ITERATIONS
):
self
.
damage
(
4
,
512
)
output
=
self
.
recover
()
self
.
assert
_
(
'error'
in
output
,
output
)
self
.
assert
True
(
'error'
in
output
,
output
)
self
.
recovered
=
FileStorage
(
self
.
dest
)
self
.
recovered
.
close
()
os
.
remove
(
self
.
path
)
...
...
@@ -141,7 +141,7 @@ class RecoverTest(ZODB.tests.util.TestCase):
for
i
in
range
(
self
.
ITERATIONS
):
self
.
damage
(
1
,
32
*
1024
)
output
=
self
.
recover
()
self
.
assert
_
(
'error'
in
output
,
output
)
self
.
assert
True
(
'error'
in
output
,
output
)
self
.
recovered
=
FileStorage
(
self
.
dest
)
self
.
recovered
.
close
()
os
.
remove
(
self
.
path
)
...
...
src/ZODB/tests/testSerialize.py
View file @
9509d1a6
...
...
@@ -95,14 +95,14 @@ class SerializerTestCase(unittest.TestCase):
r
=
TestObjectReader
(
factory
=
test_factory
)
g
=
r
.
getGhost
(
self
.
old_style_with_newargs
)
self
.
assert
_
(
isinstance
(
g
,
ClassWithNewargs
))
self
.
assert
True
(
isinstance
(
g
,
ClassWithNewargs
))
self
.
assertEqual
(
g
,
1
)
g
=
r
.
getGhost
(
self
.
old_style_without_newargs
)
self
.
assert
_
(
isinstance
(
g
,
ClassWithoutNewargs
))
self
.
assert
True
(
isinstance
(
g
,
ClassWithoutNewargs
))
g
=
r
.
getGhost
(
self
.
new_style_with_newargs
)
self
.
assert
_
(
isinstance
(
g
,
ClassWithNewargs
))
self
.
assert
True
(
isinstance
(
g
,
ClassWithNewargs
))
g
=
r
.
getGhost
(
self
.
new_style_without_newargs
)
self
.
assert
_
(
isinstance
(
g
,
ClassWithoutNewargs
))
self
.
assert
True
(
isinstance
(
g
,
ClassWithoutNewargs
))
def
test_myhasattr
(
self
):
...
...
@@ -124,14 +124,15 @@ class SerializerTestCase(unittest.TestCase):
serialize
.
myhasattr
,
OldStyle
(),
"error"
)
self
.
assertRaises
(
ValueError
,
serialize
.
myhasattr
,
NewStyle
(),
"error"
)
self
.
assert
_
(
serialize
.
myhasattr
(
OldStyle
(),
"bar"
))
self
.
assert
_
(
serialize
.
myhasattr
(
NewStyle
(),
"bar"
))
self
.
assert
_
(
not
serialize
.
myhasattr
(
OldStyle
(),
"rat"
))
self
.
assert
_
(
not
serialize
.
myhasattr
(
NewStyle
(),
"rat"
))
self
.
assert
True
(
serialize
.
myhasattr
(
OldStyle
(),
"bar"
))
self
.
assert
True
(
serialize
.
myhasattr
(
NewStyle
(),
"bar"
))
self
.
assert
True
(
not
serialize
.
myhasattr
(
OldStyle
(),
"rat"
))
self
.
assert
True
(
not
serialize
.
myhasattr
(
NewStyle
(),
"rat"
))
def
test_suite
():
suite
=
unittest
.
makeSuite
(
SerializerTestCase
)
suite
.
addTest
(
doctest
.
DocTestSuite
(
"ZODB.serialize"
,
checker
=
ZODB
.
tests
.
util
.
checker
))
doctest
.
DocTestSuite
(
"ZODB.serialize"
,
checker
=
ZODB
.
tests
.
util
.
checker
))
return
suite
src/ZODB/tests/testUtils.py
View file @
9509d1a6
...
...
@@ -88,7 +88,7 @@ class TestUtils(unittest.TestCase):
# The pickle contains a GLOBAL ('c') opcode resolving to MinPO's
# module and class.
self
.
assert
_
(
b'cZODB.tests.MinPO
\
n
MinPO
\
n
'
in
data
)
self
.
assert
True
(
b'cZODB.tests.MinPO
\
n
MinPO
\
n
'
in
data
)
# Fiddle the pickle so it points to something "impossible" instead.
data
=
data
.
replace
(
b'cZODB.tests.MinPO
\
n
MinPO
\
n
'
,
...
...
src/ZODB/tests/testZODB.py
View file @
9509d1a6
...
...
@@ -108,7 +108,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
l1
=
list
(
map
(
lambda
k_v
:
(
k_v
[
0
],
k_v
[
1
][
0
]),
l1
))
l2
=
list
(
map
(
lambda
k_v1
:
(
k_v1
[
0
],
k_v1
[
1
][
0
]),
l2
))
self
.
assertEqual
(
l1
,
l2
)
self
.
assert
_
(
ob
.
_p_oid
!=
ob2
.
_p_oid
)
self
.
assert
True
(
ob
.
_p_oid
!=
ob2
.
_p_oid
)
self
.
assertEqual
(
ob
.
_p_jar
,
ob2
.
_p_jar
)
oids
=
{}
for
v
in
ob
.
values
():
...
...
@@ -129,7 +129,7 @@ class ZODBTests(ZODB.tests.util.TestCase):
self
.
populate
()
conn
=
self
.
_db
.
open
()
conn
.
root
()
self
.
assert
_
(
len
(
conn
.
_cache
)
>
0
)
# Precondition
self
.
assert
True
(
len
(
conn
.
_cache
)
>
0
)
# Precondition
conn
.
_resetCache
()
self
.
assertEqual
(
len
(
conn
.
_cache
),
0
)
...
...
@@ -139,10 +139,10 @@ class ZODBTests(ZODB.tests.util.TestCase):
self
.
populate
()
conn
=
self
.
_db
.
open
()
conn
.
root
()
self
.
assert
_
(
len
(
conn
.
_cache
)
>
0
)
# Precondition
self
.
assert
True
(
len
(
conn
.
_cache
)
>
0
)
# Precondition
ZODB
.
Connection
.
resetCaches
()
conn
.
close
()
self
.
assert
_
(
len
(
conn
.
_cache
)
>
0
)
# Still not flushed
self
.
assert
True
(
len
(
conn
.
_cache
)
>
0
)
# Still not flushed
conn
.
open
()
# simulate the connection being reopened
self
.
assertEqual
(
len
(
conn
.
_cache
),
0
)
...
...
@@ -517,12 +517,12 @@ class ReadConflictTests(ZODB.tests.util.TestCase):
self
.
fail
(
"No conflict occurred"
)
# real_data2 still ready to commit
self
.
assert
_
(
real_data2
.
_p_changed
)
self
.
assert
True
(
real_data2
.
_p_changed
)
# index2 values not ready to commit
self
.
assert
_
(
not
index2
.
_p_changed
)
self
.
assert
_
(
not
index2
[
0
].
_p_changed
)
self
.
assert
_
(
not
index2
[
1
].
_p_changed
)
self
.
assert
True
(
not
index2
.
_p_changed
)
self
.
assert
True
(
not
index2
[
0
].
_p_changed
)
self
.
assert
True
(
not
index2
[
1
].
_p_changed
)
self
.
assertRaises
(
ReadConflictError
,
tm
.
get
().
commit
)
self
.
assertRaises
(
TransactionFailedError
,
tm
.
get
().
commit
)
...
...
src/ZODB/tests/testblob.py
View file @
9509d1a6
...
...
@@ -280,7 +280,7 @@ class RecoveryBlobStorage(BlobTestBase,
# Requires a setUp() that creates a self._dst destination storage
def
testSimpleBlobRecovery
(
self
):
self
.
assert
_
(
self
.
assert
True
(
ZODB
.
interfaces
.
IBlobStorageRestoreable
.
providedBy
(
self
.
_storage
)
)
db
=
DB
(
self
.
_storage
)
...
...
@@ -514,7 +514,7 @@ def loadblob_tmpstore():
We can access the blob correctly:
>>> tmpstore.loadBlob(blob_oid,
tid) == blob_storage.loadBlob(blob_oid,
tid)
>>> tmpstore.loadBlob(blob_oid,
tid) == blob_storage.loadBlob(blob_oid,
tid)
True
Clean up:
...
...
src/ZODB/tests/testfsIndex.py
View file @
9509d1a6
...
...
@@ -36,21 +36,21 @@ class Test(unittest.TestCase):
def
test__del__
(
self
):
index
=
self
.
index
self
.
assert
_
(
p64
(
1000
)
in
index
)
self
.
assert
_
(
p64
(
100
*
1000
)
in
index
)
self
.
assert
True
(
p64
(
1000
)
in
index
)
self
.
assert
True
(
p64
(
100
*
1000
)
in
index
)
del
self
.
index
[
p64
(
1000
)]
del
self
.
index
[
p64
(
100
*
1000
)]
self
.
assert
_
(
p64
(
1000
)
not
in
index
)
self
.
assert
_
(
p64
(
100
*
1000
)
not
in
index
)
self
.
assert
True
(
p64
(
1000
)
not
in
index
)
self
.
assert
True
(
p64
(
100
*
1000
)
not
in
index
)
for
key
in
list
(
self
.
index
):
del
index
[
key
]
self
.
assert
_
(
not
index
)
self
.
assert
True
(
not
index
)
# Whitebox. Make sure empty buckets are removed
self
.
assert
_
(
not
index
.
_data
)
self
.
assert
True
(
not
index
.
_data
)
def
testInserts
(
self
):
index
=
self
.
index
...
...
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