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 @@
...
@@ -2,14 +2,14 @@
#
#
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# Copyright (c) 2001, 2002 Zope Corporation and Contributors.
# All Rights Reserved.
# All Rights Reserved.
#
#
# This software is subject to the provisions of the Zope Public License,
# 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.
# 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
# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS
# FOR A PARTICULAR PURPOSE
# FOR A PARTICULAR PURPOSE
#
#
##############################################################################
##############################################################################
import
sys
,
os
,
time
,
random
import
sys
,
os
,
time
,
random
import
os
,
sys
import
os
,
sys
...
@@ -44,7 +44,7 @@ class Base:
...
@@ -44,7 +44,7 @@ class Base:
def
_delDB
(
self
):
def
_delDB
(
self
):
for
file
in
glob
(
'fs_tmp__*'
):
for
file
in
glob
(
'fs_tmp__*'
):
os
.
remove
(
file
)
os
.
remove
(
file
)
def
testLoadAndStore
(
self
):
def
testLoadAndStore
(
self
):
for
i
in
0
,
10
,
1000
:
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
t
=
self
.
t
.
__class__
()
...
@@ -72,7 +72,7 @@ class Base:
...
@@ -72,7 +72,7 @@ class Base:
finally
:
finally
:
self
.
_closeDB
(
root
)
self
.
_closeDB
(
root
)
self
.
_delDB
()
self
.
_delDB
()
def
testGhostUnghost
(
self
):
def
testGhostUnghost
(
self
):
for
i
in
0
,
10
,
1000
:
for
i
in
0
,
10
,
1000
:
t
=
self
.
t
.
__class__
()
t
=
self
.
t
.
__class__
()
...
@@ -108,7 +108,7 @@ class MappingBase(Base):
...
@@ -108,7 +108,7 @@ class MappingBase(Base):
def
_populate
(
self
,
t
,
l
):
def
_populate
(
self
,
t
,
l
):
# Make some data
# Make some data
for
i
in
range
(
l
):
t
[
i
]
=
i
for
i
in
range
(
l
):
t
[
i
]
=
i
def
testGetItemFails
(
self
):
def
testGetItemFails
(
self
):
self
.
assertRaises
(
KeyError
,
self
.
_getitemfail
)
self
.
assertRaises
(
KeyError
,
self
.
_getitemfail
)
...
@@ -118,7 +118,7 @@ class MappingBase(Base):
...
@@ -118,7 +118,7 @@ class MappingBase(Base):
def
testGetReturnsDefault
(
self
):
def
testGetReturnsDefault
(
self
):
self
.
assertEqual
(
self
.
t
.
get
(
1
)
,
None
)
self
.
assertEqual
(
self
.
t
.
get
(
1
)
,
None
)
self
.
assertEqual
(
self
.
t
.
get
(
1
,
'foo'
)
,
'foo'
)
self
.
assertEqual
(
self
.
t
.
get
(
1
,
'foo'
)
,
'foo'
)
def
testSetItemGetItemWorks
(
self
):
def
testSetItemGetItemWorks
(
self
):
self
.
t
[
1
]
=
1
self
.
t
[
1
]
=
1
a
=
self
.
t
[
1
]
a
=
self
.
t
[
1
]
...
@@ -154,14 +154,14 @@ class MappingBase(Base):
...
@@ -154,14 +154,14 @@ class MappingBase(Base):
def
testValuesWorks1
(
self
):
def
testValuesWorks1
(
self
):
for
x
in
range
(
100
):
for
x
in
range
(
100
):
self
.
t
[
99
-
x
]
=
x
self
.
t
[
99
-
x
]
=
x
for
x
in
range
(
40
):
for
x
in
range
(
40
):
lst
=
list
(
self
.
t
.
values
(
0
+
x
,
99
-
x
))
lst
=
list
(
self
.
t
.
values
(
0
+
x
,
99
-
x
))
lst
.
sort
()
lst
.
sort
()
self
.
assertEqual
(
lst
,
range
(
0
+
x
,
99
-
x
+
1
))
self
.
assertEqual
(
lst
,
range
(
0
+
x
,
99
-
x
+
1
))
def
testKeysWorks
(
self
):
def
testKeysWorks
(
self
):
for
x
in
range
(
100
):
for
x
in
range
(
100
):
self
.
t
[
x
]
=
x
self
.
t
[
x
]
=
x
...
@@ -229,7 +229,7 @@ class MappingBase(Base):
...
@@ -229,7 +229,7 @@ class MappingBase(Base):
k
=
random
.
randrange
(
-
2000
,
2001
)
k
=
random
.
randrange
(
-
2000
,
2001
)
d
[
k
]
=
i
d
[
k
]
=
i
l
.
append
((
k
,
i
))
l
.
append
((
k
,
i
))
items
=
d
.
items
()
items
=
d
.
items
()
items
.
sort
()
items
.
sort
()
...
@@ -249,13 +249,13 @@ class MappingBase(Base):
...
@@ -249,13 +249,13 @@ class MappingBase(Base):
self
.
assertEqual
(
list
(
t
.
keys
(
2
,
4
)),[],
list
(
t
.
keys
(
2
,
4
)))
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
(
6
,
8
)),[],
list
(
t
.
keys
(
6
,
8
)))
self
.
assertEqual
(
list
(
t
.
keys
(
10
,
12
)),[],
list
(
t
.
keys
(
10
,
12
)))
self
.
assertEqual
(
list
(
t
.
keys
(
10
,
12
)),[],
list
(
t
.
keys
(
10
,
12
)))
class
NormalSetTests
(
Base
):
class
NormalSetTests
(
Base
):
""" Test common to all set types """
""" Test common to all set types """
def
_populate
(
self
,
t
,
l
):
def
_populate
(
self
,
t
,
l
):
# Make some data
# Make some data
t
.
update
(
range
(
l
))
t
.
update
(
range
(
l
))
...
@@ -268,7 +268,7 @@ class NormalSetTests(Base):
...
@@ -268,7 +268,7 @@ class NormalSetTests(Base):
t
=
self
.
t
t
=
self
.
t
t
.
insert
(
5
)
t
.
insert
(
5
)
self
.
assertEqual
(
t
.
insert
(
5
)
,
0
)
self
.
assertEqual
(
t
.
insert
(
5
)
,
0
)
def
testInsert
(
self
):
def
testInsert
(
self
):
t
=
self
.
t
t
=
self
.
t
t
.
insert
(
1
)
t
.
insert
(
1
)
...
@@ -337,7 +337,7 @@ class NormalSetTests(Base):
...
@@ -337,7 +337,7 @@ class NormalSetTests(Base):
k
=
random
.
randrange
(
-
2000
,
2001
)
k
=
random
.
randrange
(
-
2000
,
2001
)
d
[
k
]
=
i
d
[
k
]
=
i
l
.
append
(
k
)
l
.
append
(
k
)
items
=
d
.
keys
()
items
=
d
.
keys
()
items
.
sort
()
items
.
sort
()
...
@@ -365,7 +365,7 @@ class ExtendedSetTests(NormalSetTests):
...
@@ -365,7 +365,7 @@ class ExtendedSetTests(NormalSetTests):
for
x
in
r
:
t
.
insert
(
x
)
for
x
in
r
:
t
.
insert
(
x
)
for
x
in
r
:
for
x
in
r
:
self
.
assertEqual
(
t
[
x
]
,
x
)
self
.
assertEqual
(
t
[
x
]
,
x
)
class
BucketTests
(
MappingBase
):
class
BucketTests
(
MappingBase
):
""" Tests common to all buckets """
""" Tests common to all buckets """
pass
pass
...
@@ -407,7 +407,7 @@ class BTreeTests(MappingBase):
...
@@ -407,7 +407,7 @@ class BTreeTests(MappingBase):
del
self
.
t
[
2
]
del
self
.
t
[
2
]
diff
=
lsubtract
(
self
.
t
.
keys
(),
[
1
,
3
,
4
,
5
,
6
,
10
])
diff
=
lsubtract
(
self
.
t
.
keys
(),
[
1
,
3
,
4
,
5
,
6
,
10
])
self
.
assertEqual
(
diff
,
[],
diff
)
self
.
assertEqual
(
diff
,
[],
diff
)
def
testDeleteTwoChildrenInorderSuccessorWorks
(
self
):
def
testDeleteTwoChildrenInorderSuccessorWorks
(
self
):
""" 7, 3, 8, 1, 5, 10, 6, 4 -- del 3 """
""" 7, 3, 8, 1, 5, 10, 6, 4 -- del 3 """
self
.
t
[
7
]
=
6
self
.
t
[
7
]
=
6
...
@@ -493,7 +493,7 @@ class BTreeTests(MappingBase):
...
@@ -493,7 +493,7 @@ class BTreeTests(MappingBase):
except
KeyError
:
except
KeyError
:
pass
pass
self
.
assertEqual
(
realseq
(
self
.
t
.
keys
())
,
[],
realseq
(
self
.
t
.
keys
()))
self
.
assertEqual
(
realseq
(
self
.
t
.
keys
())
,
[],
realseq
(
self
.
t
.
keys
()))
def
testPathologicalRightBranching
(
self
):
def
testPathologicalRightBranching
(
self
):
r
=
range
(
1000
)
r
=
range
(
1000
)
for
x
in
r
:
for
x
in
r
:
...
@@ -704,7 +704,7 @@ class TestOISets(ExtendedSetTests, TestCase):
...
@@ -704,7 +704,7 @@ class TestOISets(ExtendedSetTests, TestCase):
class
TestIOTreeSets
(
NormalSetTests
,
TestCase
):
class
TestIOTreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
t
=
IOTreeSet
()
self
.
t
=
IOTreeSet
()
class
TestOOTreeSets
(
NormalSetTests
,
TestCase
):
class
TestOOTreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
t
=
OOTreeSet
()
self
.
t
=
OOTreeSet
()
...
@@ -716,7 +716,7 @@ class TestIITreeSets(NormalSetTests, TestCase):
...
@@ -716,7 +716,7 @@ class TestIITreeSets(NormalSetTests, TestCase):
class
TestOITreeSets
(
NormalSetTests
,
TestCase
):
class
TestOITreeSets
(
NormalSetTests
,
TestCase
):
def
setUp
(
self
):
def
setUp
(
self
):
self
.
t
=
OITreeSet
()
self
.
t
=
OITreeSet
()
## Bucket tests
## Bucket tests
class
TestIOBuckets
(
BucketTests
,
TestCase
):
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