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
a6605d20
Commit
a6605d20
authored
May 12, 2008
by
Jim Fulton
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added a __del__ to fsIndex.
parent
ee303d4a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
27 additions
and
0 deletions
+27
-0
src/ZODB/fsIndex.py
src/ZODB/fsIndex.py
+9
-0
src/ZODB/tests/testfsIndex.py
src/ZODB/tests/testfsIndex.py
+18
-0
No files found.
src/ZODB/fsIndex.py
View file @
a6605d20
...
...
@@ -83,6 +83,15 @@ class fsIndex(object):
self
.
_data
[
treekey
]
=
tree
tree
[
key
[
6
:]]
=
value
def
__delitem__
(
self
,
key
):
treekey
=
key
[:
6
]
tree
=
self
.
_data
.
get
(
treekey
)
if
tree
is
None
:
raise
KeyError
,
key
del
tree
[
key
[
6
:]]
if
not
tree
:
del
self
.
_data
[
treekey
]
def
__len__
(
self
):
r
=
0
for
tree
in
self
.
_data
.
itervalues
():
...
...
src/ZODB/tests/testfsIndex.py
View file @
a6605d20
...
...
@@ -26,6 +26,24 @@ class Test(unittest.TestCase):
for
i
in
range
(
200
):
self
.
index
[
p64
(
i
*
1000
)]
=
(
i
*
1000L
+
1
)
def
test__del__
(
self
):
index
=
self
.
index
self
.
assert_
(
p64
(
1000
)
in
index
)
self
.
assert_
(
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
)
for
key
in
list
(
self
.
index
):
del
index
[
key
]
self
.
assert_
(
not
index
)
# Whitebox. Make sure empty buckets are removed
self
.
assert_
(
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