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
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Joshua
zodb
Commits
cb8b868e
Commit
cb8b868e
authored
Apr 23, 2003
by
Jeremy Hylton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Backport simplified versions of BTrees tests from ZOpe3.
parent
18cd8b10
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
36 additions
and
57 deletions
+36
-57
src/BTrees/tests/testBTrees.py
src/BTrees/tests/testBTrees.py
+36
-57
No files found.
src/BTrees/tests/testBTrees.py
View file @
cb8b868e
...
...
@@ -26,85 +26,64 @@ from unittest import TestCase, TestSuite, TextTestRunner, makeSuite
from
glob
import
glob
from
ZODB.tests.StorageTestBase
import
removefs
from
ZODB
import
DB
from
ZODB.MappingStorage
import
MappingStorage
class
Base
:
""" Tests common to all types: sets, buckets, and BTrees """
db
=
None
def
tearDown
(
self
):
self
.
t
=
None
del
self
.
t
if
self
.
db
is
not
None
:
self
.
db
.
close
()
def
_getRoot
(
self
):
from
ZODB.FileStorage
import
FileStorage
from
ZODB.DB
import
DB
self
.
_fsname
=
'fs_tmp__%s'
%
os
.
getpid
()
s
=
FileStorage
(
self
.
_fsname
)
db
=
DB
(
s
)
root
=
db
.
open
().
root
()
return
root
def
_closeDB
(
self
,
root
):
if
root
is
not
None
:
root
.
_p_jar
.
_db
.
close
()
if
self
.
db
is
None
:
self
.
db
=
DB
(
MappingStorage
())
return
self
.
db
.
open
().
root
()
def
_
delDB
(
self
):
r
emovefs
(
self
.
_fsname
)
def
_
closeRoot
(
self
,
root
):
r
oot
.
_p_jar
.
close
(
)
def
testLoadAndStore
(
self
):
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
self
.
_populate
(
t
,
i
)
root
=
None
try
:
root
=
self
.
_getRoot
()
root
[
i
]
=
t
get_transaction
().
commit
()
except
:
self
.
_closeDB
(
root
)
self
.
_delDB
()
raise
root
=
self
.
_getRoot
()
root
[
i
]
=
t
get_transaction
().
commit
()
self
.
_closeDB
(
root
)
root2
=
self
.
_getRoot
()
if
hasattr
(
t
,
'items'
):
self
.
assertEqual
(
list
(
root2
[
i
].
items
())
,
list
(
t
.
items
()))
else
:
self
.
assertEqual
(
list
(
root2
[
i
].
keys
())
,
list
(
t
.
keys
()))
root
=
None
try
:
root
=
self
.
_getRoot
()
#XXX BTree stuff doesn't implement comparison
if
hasattr
(
t
,
'items'
):
self
.
assertEqual
(
list
(
root
[
i
].
items
())
,
list
(
t
.
items
()))
else
:
self
.
assertEqual
(
list
(
root
[
i
].
keys
())
,
list
(
t
.
keys
()))
finally
:
self
.
_closeDB
(
root
)
self
.
_delDB
()
self
.
_closeRoot
(
root
)
self
.
_closeRoot
(
root2
)
def
testGhostUnghost
(
self
):
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
self
.
_populate
(
t
,
i
)
root
=
None
try
:
root
=
self
.
_getRoot
()
root
[
i
]
=
t
get_transaction
().
commit
()
except
:
self
.
_closeDB
(
root
)
self
.
_delDB
()
raise
self
.
_closeDB
(
root
)
root
=
None
try
:
root
=
self
.
_getRoot
()
root
[
i
].
_p_changed
=
None
get_transaction
().
commit
()
if
hasattr
(
t
,
'items'
):
self
.
assertEqual
(
list
(
root
[
i
].
items
())
,
list
(
t
.
items
()))
else
:
self
.
assertEqual
(
list
(
root
[
i
].
keys
())
,
list
(
t
.
keys
()))
finally
:
self
.
_closeDB
(
root
)
self
.
_delDB
()
root
=
self
.
_getRoot
()
root
[
i
]
=
t
get_transaction
().
commit
()
root2
=
self
.
_getRoot
()
root2
[
i
].
_p_deactivate
()
get_transaction
().
commit
()
if
hasattr
(
t
,
'items'
):
self
.
assertEqual
(
list
(
root2
[
i
].
items
())
,
list
(
t
.
items
()))
else
:
self
.
assertEqual
(
list
(
root2
[
i
].
keys
())
,
list
(
t
.
keys
()))
self
.
_closeRoot
(
root
)
self
.
_closeRoot
(
root2
)
class
MappingBase
(
Base
):
""" Tests common to mappings (buckets, btrees) """
...
...
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