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
nexedi
ZODB
Commits
918da832
Commit
918da832
authored
Jun 09, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Trimmed trailing whitespace.
parent
585f31ad
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
18 deletions
+18
-18
src/BTrees/tests/testBTrees.py
src/BTrees/tests/testBTrees.py
+18
-18
No files found.
src/BTrees/tests/testBTrees.py
View file @
918da832
...
...
@@ -2,14 +2,14 @@
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
#
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.0 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
#
#
##############################################################################
import
sys
,
os
,
time
,
random
import
os
,
sys
...
...
@@ -44,7 +44,7 @@ class Base:
def
_delDB
(
self
):
for
file
in
glob
(
'fs_tmp__*'
):
os
.
remove
(
file
)
def
testLoadAndStore
(
self
):
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
...
...
@@ -72,7 +72,7 @@ class Base:
finally
:
self
.
_closeDB
(
root
)
self
.
_delDB
()
def
testGhostUnghost
(
self
):
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
...
...
@@ -108,7 +108,7 @@ class MappingBase(Base):
def
_populate
(
self
,
t
,
l
):
# Make some data
for
i
in
range
(
l
):
t
[
i
]
=
i
def
testGetItemFails
(
self
):
self
.
assertRaises
(
KeyError
,
self
.
_getitemfail
)
...
...
@@ -118,7 +118,7 @@ class MappingBase(Base):
def
testGetReturnsDefault
(
self
):
self
.
assertEqual
(
self
.
t
.
get
(
1
)
,
None
)
self
.
assertEqual
(
self
.
t
.
get
(
1
,
'foo'
)
,
'foo'
)
def
testSetItemGetItemWorks
(
self
):
self
.
t
[
1
]
=
1
a
=
self
.
t
[
1
]
...
...
@@ -154,14 +154,14 @@ class MappingBase(Base):
def
testValuesWorks1
(
self
):
for
x
in
range
(
100
):
self
.
t
[
99
-
x
]
=
x
self
.
t
[
99
-
x
]
=
x
for
x
in
range
(
40
):
lst
=
list
(
self
.
t
.
values
(
0
+
x
,
99
-
x
))
lst
.
sort
()
self
.
assertEqual
(
lst
,
range
(
0
+
x
,
99
-
x
+
1
))
def
testKeysWorks
(
self
):
for
x
in
range
(
100
):
self
.
t
[
x
]
=
x
...
...
@@ -229,7 +229,7 @@ class MappingBase(Base):
k
=
random
.
randrange
(
-
2000
,
2001
)
d
[
k
]
=
i
l
.
append
((
k
,
i
))
items
=
d
.
items
()
items
.
sort
()
...
...
@@ -249,13 +249,13 @@ class MappingBase(Base):
self
.
assertEqual
(
list
(
t
.
keys
(
2
,
4
)),[],
list
(
t
.
keys
(
2
,
4
)))
self
.
assertEqual
(
list
(
t
.
keys
(
6
,
8
)),[],
list
(
t
.
keys
(
6
,
8
)))
self
.
assertEqual
(
list
(
t
.
keys
(
10
,
12
)),[],
list
(
t
.
keys
(
10
,
12
)))
class
NormalSetTests
(
Base
):
""" Test common to all set types """
def
_populate
(
self
,
t
,
l
):
def
_populate
(
self
,
t
,
l
):
# Make some data
t
.
update
(
range
(
l
))
...
...
@@ -268,7 +268,7 @@ class NormalSetTests(Base):
t
=
self
.
t
t
.
insert
(
5
)
self
.
assertEqual
(
t
.
insert
(
5
)
,
0
)
def
testInsert
(
self
):
t
=
self
.
t
t
.
insert
(
1
)
...
...
@@ -337,7 +337,7 @@ class NormalSetTests(Base):
k
=
random
.
randrange
(
-
2000
,
2001
)
d
[
k
]
=
i
l
.
append
(
k
)
items
=
d
.
keys
()
items
.
sort
()
...
...
@@ -365,7 +365,7 @@ class ExtendedSetTests(NormalSetTests):
for
x
in
r
:
t
.
insert
(
x
)
for
x
in
r
:
self
.
assertEqual
(
t
[
x
]
,
x
)
class
BucketTests
(
MappingBase
):
""" Tests common to all buckets """
pass
...
...
@@ -407,7 +407,7 @@ class BTreeTests(MappingBase):
del
self
.
t
[
2
]
diff
=
lsubtract
(
self
.
t
.
keys
(),
[
1
,
3
,
4
,
5
,
6
,
10
])
self
.
assertEqual
(
diff
,
[],
diff
)
def
testDeleteTwoChildrenInorderSuccessorWorks
(
self
):
""" 7, 3, 8, 1, 5, 10, 6, 4 -- del 3 """
self
.
t
[
7
]
=
6
...
...
@@ -493,7 +493,7 @@ class BTreeTests(MappingBase):
except
KeyError
:
pass
self
.
assertEqual
(
realseq
(
self
.
t
.
keys
())
,
[],
realseq
(
self
.
t
.
keys
()))
def
testPathologicalRightBranching
(
self
):
r
=
range
(
1000
)
for
x
in
r
:
...
...
@@ -704,7 +704,7 @@ class TestOISets(ExtendedSetTests, TestCase):
class
TestIOTreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
self
.
t
=
IOTreeSet
()
class
TestOOTreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
self
.
t
=
OOTreeSet
()
...
...
@@ -716,7 +716,7 @@ class TestIITreeSets(NormalSetTests, TestCase):
class
TestOITreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
self
.
t
=
OITreeSet
()
## Bucket tests
class
TestIOBuckets
(
BucketTests
,
TestCase
):
...
...
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