Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
B
BTrees
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
Kirill Smelkov
BTrees
Commits
9ec6660f
Commit
9ec6660f
authored
Dec 12, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Silence deprecations under Py3k.
parent
4a3a7006
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
74 additions
and
74 deletions
+74
-74
BTrees/tests/common.py
BTrees/tests/common.py
+48
-48
BTrees/tests/testBTrees.py
BTrees/tests/testBTrees.py
+16
-16
BTrees/tests/testConflict.py
BTrees/tests/testConflict.py
+5
-5
BTrees/tests/test_Length.py
BTrees/tests/test_Length.py
+4
-4
BTrees/tests/test_btreesubclass.py
BTrees/tests/test_btreesubclass.py
+1
-1
No files found.
BTrees/tests/common.py
View file @
9ec6660f
...
@@ -181,17 +181,17 @@ class Base(object):
...
@@ -181,17 +181,17 @@ class Base(object):
# Modifying a thing
# Modifying a thing
remove
(
100
)
remove
(
100
)
self
.
assert
_
(
t
in
read
)
self
.
assert
True
(
t
in
read
)
del
read
[:]
del
read
[:]
add
(
100
)
add
(
100
)
self
.
assert
_
(
t
in
read
)
self
.
assert
True
(
t
in
read
)
del
read
[:]
del
read
[:]
transaction
.
abort
()
transaction
.
abort
()
conn
.
cacheMinimize
()
conn
.
cacheMinimize
()
list
(
t
)
list
(
t
)
self
.
assert
_
(
100
in
t
)
self
.
assert
True
(
100
in
t
)
self
.
assert
_
(
not
read
)
self
.
assert
True
(
not
read
)
class
MappingBase
(
Base
):
class
MappingBase
(
Base
):
...
@@ -214,7 +214,7 @@ class MappingBase(Base):
...
@@ -214,7 +214,7 @@ class MappingBase(Base):
# But since the test is also run for btrees, skip the length
# But since the test is also run for btrees, skip the length
# check if the repr starts with '<'
# check if the repr starts with '<'
if
not
r
.
startswith
(
'<'
):
if
not
r
.
startswith
(
'<'
):
self
.
assert
_
(
len
(
r
)
>
10000
)
self
.
assert
True
(
len
(
r
)
>
10000
)
def
testGetItemFails
(
self
):
def
testGetItemFails
(
self
):
self
.
assertRaises
(
KeyError
,
self
.
_getitemfail
)
self
.
assertRaises
(
KeyError
,
self
.
_getitemfail
)
...
@@ -256,10 +256,10 @@ class MappingBase(Base):
...
@@ -256,10 +256,10 @@ class MappingBase(Base):
t
=
self
.
_makeOne
()
t
=
self
.
_makeOne
()
t
[
1
]
=
1
t
[
1
]
=
1
if
PY2
:
if
PY2
:
self
.
assert
_
(
t
.
has_key
(
1
))
self
.
assert
True
(
t
.
has_key
(
1
))
self
.
assert
_
(
1
in
t
)
self
.
assert
True
(
1
in
t
)
self
.
assert
_
(
0
not
in
t
)
self
.
assert
True
(
0
not
in
t
)
self
.
assert
_
(
2
not
in
t
)
self
.
assert
True
(
2
not
in
t
)
def
testValuesWorks
(
self
):
def
testValuesWorks
(
self
):
t
=
self
.
_makeOne
()
t
=
self
.
_makeOne
()
...
@@ -560,7 +560,7 @@ class MappingBase(Base):
...
@@ -560,7 +560,7 @@ class MappingBase(Base):
self
.
assertEqual
(
x
,
keys
)
self
.
assertEqual
(
x
,
keys
)
it
=
iter
(
t
)
it
=
iter
(
t
)
self
.
assert
_
(
it
is
iter
(
it
))
self
.
assert
True
(
it
is
iter
(
it
))
x
=
[]
x
=
[]
try
:
try
:
while
1
:
while
1
:
...
@@ -695,7 +695,7 @@ class MappingBase(Base):
...
@@ -695,7 +695,7 @@ class MappingBase(Base):
self
.
assertEqual
(
t
.
setdefault
(
1
,
2
),
2
)
self
.
assertEqual
(
t
.
setdefault
(
1
,
2
),
2
)
# That should also have associated 1 with 2 in the tree.
# That should also have associated 1 with 2 in the tree.
self
.
assert
_
(
1
in
t
)
self
.
assert
True
(
1
in
t
)
self
.
assertEqual
(
t
[
1
],
2
)
self
.
assertEqual
(
t
[
1
],
2
)
# And trying to change it again should have no effect.
# And trying to change it again should have no effect.
self
.
assertEqual
(
t
.
setdefault
(
1
,
666
),
2
)
self
.
assertEqual
(
t
.
setdefault
(
1
,
666
),
2
)
...
@@ -869,7 +869,7 @@ class BTreeTests(MappingBase):
...
@@ -869,7 +869,7 @@ class BTreeTests(MappingBase):
for
x
in
r
:
for
x
in
r
:
k
=
random
.
choice
(
r
)
k
=
random
.
choice
(
r
)
if
k
in
t
:
if
k
in
t
:
self
.
assert
_
(
k
in
t
)
self
.
assert
True
(
k
in
t
)
del
t
[
k
]
del
t
[
k
]
deleted
.
append
(
k
)
deleted
.
append
(
k
)
if
k
in
t
:
if
k
in
t
:
...
@@ -998,7 +998,7 @@ class BTreeTests(MappingBase):
...
@@ -998,7 +998,7 @@ class BTreeTests(MappingBase):
for
i
in
range
(
200
):
for
i
in
range
(
200
):
t
[
i
]
=
i
t
[
i
]
=
i
items
,
dummy
=
t
.
__getstate__
()
items
,
dummy
=
t
.
__getstate__
()
self
.
assert
_
(
len
(
items
)
>
2
)
# at least two buckets and a key
self
.
assert
True
(
len
(
items
)
>
2
)
# at least two buckets and a key
# All values in the first bucket are < firstkey. All in the
# All values in the first bucket are < firstkey. All in the
# second bucket are >= firstkey, and firstkey is the first key in
# second bucket are >= firstkey, and firstkey is the first key in
# the second bucket.
# the second bucket.
...
@@ -1082,9 +1082,9 @@ class NormalSetTests(Base):
...
@@ -1082,9 +1082,9 @@ class NormalSetTests(Base):
t
=
self
.
_makeOne
()
t
=
self
.
_makeOne
()
t
.
insert
(
1
)
t
.
insert
(
1
)
if
PY2
:
if
PY2
:
self
.
assert
_
(
t
.
has_key
(
1
))
self
.
assert
True
(
t
.
has_key
(
1
))
self
.
assert
_
(
1
in
t
)
self
.
assert
True
(
1
in
t
)
self
.
assert
_
(
2
not
in
t
)
self
.
assert
True
(
2
not
in
t
)
def
testBigInsert
(
self
):
def
testBigInsert
(
self
):
from
.._compat
import
PY2
from
.._compat
import
PY2
...
@@ -1095,8 +1095,8 @@ class NormalSetTests(Base):
...
@@ -1095,8 +1095,8 @@ class NormalSetTests(Base):
t
.
insert
(
x
)
t
.
insert
(
x
)
for
x
in
r
:
for
x
in
r
:
if
PY2
:
if
PY2
:
self
.
assert
_
(
t
.
has_key
(
x
))
self
.
assert
True
(
t
.
has_key
(
x
))
self
.
assert
_
(
x
in
t
)
self
.
assert
True
(
x
in
t
)
def
testRemoveSucceeds
(
self
):
def
testRemoveSucceeds
(
self
):
from
.._compat
import
xrange
from
.._compat
import
xrange
...
@@ -1115,8 +1115,8 @@ class NormalSetTests(Base):
...
@@ -1115,8 +1115,8 @@ class NormalSetTests(Base):
from
.._compat
import
PY2
from
.._compat
import
PY2
t
=
self
.
_makeOne
()
t
=
self
.
_makeOne
()
if
PY2
:
if
PY2
:
self
.
assert
_
(
not
t
.
has_key
(
1
))
self
.
assert
True
(
not
t
.
has_key
(
1
))
self
.
assert
_
(
1
not
in
t
)
self
.
assert
True
(
1
not
in
t
)
def
testKeys
(
self
):
def
testKeys
(
self
):
from
.._compat
import
xrange
from
.._compat
import
xrange
...
@@ -1153,10 +1153,10 @@ class NormalSetTests(Base):
...
@@ -1153,10 +1153,10 @@ class NormalSetTests(Base):
self
.
assertEqual
(
t
.
minKey
()
,
1
)
self
.
assertEqual
(
t
.
minKey
()
,
1
)
self
.
assertEqual
(
t
.
minKey
(
3
)
,
3
)
self
.
assertEqual
(
t
.
minKey
(
3
)
,
3
)
self
.
assertEqual
(
t
.
minKey
(
9
)
,
10
)
self
.
assertEqual
(
t
.
minKey
(
9
)
,
10
)
self
.
assert
_
(
t
.
minKey
()
in
t
)
self
.
assert
True
(
t
.
minKey
()
in
t
)
self
.
assert
_
(
t
.
minKey
()
-
1
not
in
t
)
self
.
assert
True
(
t
.
minKey
()
-
1
not
in
t
)
self
.
assert
_
(
t
.
maxKey
()
in
t
)
self
.
assert
True
(
t
.
maxKey
()
in
t
)
self
.
assert
_
(
t
.
maxKey
()
+
1
not
in
t
)
self
.
assert
True
(
t
.
maxKey
()
+
1
not
in
t
)
try
:
try
:
t
.
maxKey
(
t
.
minKey
()
-
1
)
t
.
maxKey
(
t
.
minKey
()
-
1
)
...
@@ -1254,7 +1254,7 @@ class NormalSetTests(Base):
...
@@ -1254,7 +1254,7 @@ class NormalSetTests(Base):
self
.
assertEqual
(
x
,
keys
)
self
.
assertEqual
(
x
,
keys
)
it
=
iter
(
t
)
it
=
iter
(
t
)
self
.
assert
_
(
it
is
iter
(
it
))
self
.
assert
True
(
it
is
iter
(
it
))
x
=
[]
x
=
[]
try
:
try
:
while
1
:
while
1
:
...
@@ -1320,10 +1320,10 @@ class InternalKeysMappingTest(object):
...
@@ -1320,10 +1320,10 @@ class InternalKeysMappingTest(object):
key
=
data
[
1
]
key
=
data
[
1
]
del
tree
[
key
]
del
tree
[
key
]
data
=
tree
.
__getstate__
()[
0
]
data
=
tree
.
__getstate__
()[
0
]
self
.
assert
_
(
data
[
1
]
!=
key
)
self
.
assert
True
(
data
[
1
]
!=
key
)
# The tree should have changed:
# The tree should have changed:
self
.
assert
_
(
tree
.
_p_changed
)
self
.
assert
True
(
tree
.
_p_changed
)
# Grow the btree until we have multiple levels
# Grow the btree until we have multiple levels
while
1
:
while
1
:
...
@@ -1338,7 +1338,7 @@ class InternalKeysMappingTest(object):
...
@@ -1338,7 +1338,7 @@ class InternalKeysMappingTest(object):
key
=
data
[
1
]
key
=
data
[
1
]
del
tree
[
key
]
del
tree
[
key
]
data
=
tree
.
__getstate__
()[
0
]
data
=
tree
.
__getstate__
()[
0
]
self
.
assert
_
(
data
[
1
]
!=
key
)
self
.
assert
True
(
data
[
1
]
!=
key
)
transaction
.
abort
()
transaction
.
abort
()
db
.
close
()
db
.
close
()
...
@@ -1360,7 +1360,7 @@ class ModuleTest(object):
...
@@ -1360,7 +1360,7 @@ class ModuleTest(object):
for
name
in
(
'Bucket'
,
'BTree'
,
'Set'
,
'TreeSet'
):
for
name
in
(
'Bucket'
,
'BTree'
,
'Set'
,
'TreeSet'
):
klass
=
getattr
(
self
.
_getModule
(),
name
)
klass
=
getattr
(
self
.
_getModule
(),
name
)
self
.
assertEqual
(
klass
.
__module__
,
self
.
_getModule
().
__name__
)
self
.
assertEqual
(
klass
.
__module__
,
self
.
_getModule
().
__name__
)
self
.
assert
_
(
klass
is
getattr
(
self
.
_getModule
(),
self
.
assert
True
(
klass
is
getattr
(
self
.
_getModule
(),
self
.
prefix
+
name
))
self
.
prefix
+
name
))
def
testModuleProvides
(
self
):
def
testModuleProvides
(
self
):
...
@@ -1370,12 +1370,12 @@ class ModuleTest(object):
...
@@ -1370,12 +1370,12 @@ class ModuleTest(object):
def
testFamily
(
self
):
def
testFamily
(
self
):
import
BTrees
import
BTrees
if
self
.
prefix
==
'OO'
:
if
self
.
prefix
==
'OO'
:
self
.
assert
_
(
self
.
assert
True
(
getattr
(
self
.
_getModule
(),
'family'
,
self
)
is
self
)
getattr
(
self
.
_getModule
(),
'family'
,
self
)
is
self
)
elif
'L'
in
self
.
prefix
:
elif
'L'
in
self
.
prefix
:
self
.
assert
_
(
self
.
_getModule
().
family
is
BTrees
.
family64
)
self
.
assert
True
(
self
.
_getModule
().
family
is
BTrees
.
family64
)
elif
'I'
in
self
.
prefix
:
elif
'I'
in
self
.
prefix
:
self
.
assert
_
(
self
.
_getModule
().
family
is
BTrees
.
family32
)
self
.
assert
True
(
self
.
_getModule
().
family
is
BTrees
.
family32
)
class
TypeTest
(
object
):
class
TypeTest
(
object
):
...
@@ -1569,39 +1569,39 @@ class SetResult(object):
...
@@ -1569,39 +1569,39 @@ class SetResult(object):
def
testNone
(
self
):
def
testNone
(
self
):
for
op
in
self
.
union
,
self
.
intersection
,
self
.
difference
:
for
op
in
self
.
union
,
self
.
intersection
,
self
.
difference
:
C
=
op
(
None
,
None
)
C
=
op
(
None
,
None
)
self
.
assert
_
(
C
is
None
)
self
.
assert
True
(
C
is
None
)
for
op
in
self
.
union
,
self
.
intersection
,
self
.
difference
:
for
op
in
self
.
union
,
self
.
intersection
,
self
.
difference
:
for
A
in
self
.
As
:
for
A
in
self
.
As
:
C
=
op
(
A
,
None
)
C
=
op
(
A
,
None
)
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
C
=
op
(
None
,
A
)
C
=
op
(
None
,
A
)
if
op
==
self
.
difference
:
if
op
==
self
.
difference
:
self
.
assert
_
(
C
is
None
)
self
.
assert
True
(
C
is
None
)
else
:
else
:
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
def
testEmptyUnion
(
self
):
def
testEmptyUnion
(
self
):
for
A
in
self
.
As
:
for
A
in
self
.
As
:
for
E
in
self
.
emptys
:
for
E
in
self
.
emptys
:
C
=
self
.
union
(
A
,
E
)
C
=
self
.
union
(
A
,
E
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
self
.
Akeys
)
self
.
assertEqual
(
list
(
C
),
self
.
Akeys
)
C
=
self
.
union
(
E
,
A
)
C
=
self
.
union
(
E
,
A
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
self
.
Akeys
)
self
.
assertEqual
(
list
(
C
),
self
.
Akeys
)
def
testEmptyIntersection
(
self
):
def
testEmptyIntersection
(
self
):
for
A
in
self
.
As
:
for
A
in
self
.
As
:
for
E
in
self
.
emptys
:
for
E
in
self
.
emptys
:
C
=
self
.
intersection
(
A
,
E
)
C
=
self
.
intersection
(
A
,
E
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
[])
self
.
assertEqual
(
list
(
C
),
[])
C
=
self
.
intersection
(
E
,
A
)
C
=
self
.
intersection
(
E
,
A
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
[])
self
.
assertEqual
(
list
(
C
),
[])
def
testEmptyDifference
(
self
):
def
testEmptyDifference
(
self
):
...
@@ -1624,7 +1624,7 @@ class SetResult(object):
...
@@ -1624,7 +1624,7 @@ class SetResult(object):
for
A
in
inputs
:
for
A
in
inputs
:
for
B
in
inputs
:
for
B
in
inputs
:
C
=
self
.
union
(
A
,
B
)
C
=
self
.
union
(
A
,
B
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
self
.
_union
(
A
,
B
))
self
.
assertEqual
(
list
(
C
),
self
.
_union
(
A
,
B
))
def
testIntersection
(
self
):
def
testIntersection
(
self
):
...
@@ -1632,7 +1632,7 @@ class SetResult(object):
...
@@ -1632,7 +1632,7 @@ class SetResult(object):
for
A
in
inputs
:
for
A
in
inputs
:
for
B
in
inputs
:
for
B
in
inputs
:
C
=
self
.
intersection
(
A
,
B
)
C
=
self
.
intersection
(
A
,
B
)
self
.
assert
_
(
not
hasattr
(
C
,
"values"
))
self
.
assert
True
(
not
hasattr
(
C
,
"values"
))
self
.
assertEqual
(
list
(
C
),
self
.
_intersection
(
A
,
B
))
self
.
assertEqual
(
list
(
C
),
self
.
_intersection
(
A
,
B
))
def
testDifference
(
self
):
def
testDifference
(
self
):
...
@@ -1698,33 +1698,33 @@ class Weighted(object):
...
@@ -1698,33 +1698,33 @@ class Weighted(object):
def
testBothNone
(
self
):
def
testBothNone
(
self
):
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
w
,
C
=
op
(
None
,
None
)
w
,
C
=
op
(
None
,
None
)
self
.
assert
_
(
C
is
None
)
self
.
assert
True
(
C
is
None
)
self
.
assertEqual
(
w
,
0
)
self
.
assertEqual
(
w
,
0
)
w
,
C
=
op
(
None
,
None
,
42
,
666
)
w
,
C
=
op
(
None
,
None
,
42
,
666
)
self
.
assert
_
(
C
is
None
)
self
.
assert
True
(
C
is
None
)
self
.
assertEqual
(
w
,
0
)
self
.
assertEqual
(
w
,
0
)
def
testLeftNone
(
self
):
def
testLeftNone
(
self
):
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
for
A
in
self
.
As
+
self
.
emptys
:
for
A
in
self
.
As
+
self
.
emptys
:
w
,
C
=
op
(
None
,
A
)
w
,
C
=
op
(
None
,
A
)
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
self
.
assertEqual
(
w
,
1
)
self
.
assertEqual
(
w
,
1
)
w
,
C
=
op
(
None
,
A
,
42
,
666
)
w
,
C
=
op
(
None
,
A
,
42
,
666
)
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
self
.
assertEqual
(
w
,
666
)
self
.
assertEqual
(
w
,
666
)
def
testRightNone
(
self
):
def
testRightNone
(
self
):
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
for
op
in
self
.
weightedUnion
(),
self
.
weightedIntersection
():
for
A
in
self
.
As
+
self
.
emptys
:
for
A
in
self
.
As
+
self
.
emptys
:
w
,
C
=
op
(
A
,
None
)
w
,
C
=
op
(
A
,
None
)
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
self
.
assertEqual
(
w
,
1
)
self
.
assertEqual
(
w
,
1
)
w
,
C
=
op
(
A
,
None
,
42
,
666
)
w
,
C
=
op
(
A
,
None
,
42
,
666
)
self
.
assert
_
(
C
is
A
)
self
.
assert
True
(
C
is
A
)
self
.
assertEqual
(
w
,
42
)
self
.
assertEqual
(
w
,
42
)
# If obj is a set, return a bucket with values all 1; else return obj.
# If obj is a set, return a bucket with values all 1; else return obj.
...
...
BTrees/tests/testBTrees.py
View file @
9ec6660f
...
@@ -121,7 +121,7 @@ class DegenerateBTree(unittest.TestCase):
...
@@ -121,7 +121,7 @@ class DegenerateBTree(unittest.TestCase):
self
.
assertEqual
(
t
.
has_key
(
7
),
5
)
self
.
assertEqual
(
t
.
has_key
(
7
),
5
)
self
.
assertEqual
(
t
.
has_key
(
11
),
5
)
self
.
assertEqual
(
t
.
has_key
(
11
),
5
)
for
i
in
0
,
2
,
4
,
6
,
8
,
9
,
10
,
12
:
for
i
in
0
,
2
,
4
,
6
,
8
,
9
,
10
,
12
:
self
.
assert
_
(
i
not
in
t
)
self
.
assert
True
(
i
not
in
t
)
def
_checkRanges
(
self
,
tree
,
keys
):
def
_checkRanges
(
self
,
tree
,
keys
):
self
.
assertEqual
(
len
(
tree
),
len
(
keys
))
self
.
assertEqual
(
len
(
tree
),
len
(
keys
))
...
@@ -129,7 +129,7 @@ class DegenerateBTree(unittest.TestCase):
...
@@ -129,7 +129,7 @@ class DegenerateBTree(unittest.TestCase):
sorted_keys
.
sort
()
sorted_keys
.
sort
()
self
.
assertEqual
(
list
(
tree
.
keys
()),
sorted_keys
)
self
.
assertEqual
(
list
(
tree
.
keys
()),
sorted_keys
)
for
k
in
keys
:
for
k
in
keys
:
self
.
assert
_
(
k
in
tree
)
self
.
assert
True
(
k
in
tree
)
if
keys
:
if
keys
:
lokey
=
sorted_keys
[
0
]
lokey
=
sorted_keys
[
0
]
hikey
=
sorted_keys
[
-
1
]
hikey
=
sorted_keys
[
-
1
]
...
@@ -430,22 +430,22 @@ class FamilyTest(unittest.TestCase):
...
@@ -430,22 +430,22 @@ class FamilyTest(unittest.TestCase):
import
BTrees
import
BTrees
from
BTrees.IOBTree
import
IOTreeSet
from
BTrees.IOBTree
import
IOTreeSet
verifyObject
(
BTrees
.
Interfaces
.
IBTreeFamily
,
BTrees
.
family32
)
verifyObject
(
BTrees
.
Interfaces
.
IBTreeFamily
,
BTrees
.
family32
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family32
.
IO
,
BTrees
.
IOBTree
)
BTrees
.
family32
.
IO
,
BTrees
.
IOBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family32
.
OI
,
BTrees
.
OIBTree
)
BTrees
.
family32
.
OI
,
BTrees
.
OIBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family32
.
II
,
BTrees
.
IIBTree
)
BTrees
.
family32
.
II
,
BTrees
.
IIBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family32
.
IF
,
BTrees
.
IFBTree
)
BTrees
.
family32
.
IF
,
BTrees
.
IFBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family32
.
OO
,
BTrees
.
OOBTree
)
BTrees
.
family32
.
OO
,
BTrees
.
OOBTree
)
s
=
IOTreeSet
()
s
=
IOTreeSet
()
s
.
insert
(
BTrees
.
family32
.
maxint
)
s
.
insert
(
BTrees
.
family32
.
maxint
)
self
.
assert
_
(
BTrees
.
family32
.
maxint
in
s
)
self
.
assert
True
(
BTrees
.
family32
.
maxint
in
s
)
s
=
IOTreeSet
()
s
=
IOTreeSet
()
s
.
insert
(
BTrees
.
family32
.
minint
)
s
.
insert
(
BTrees
.
family32
.
minint
)
self
.
assert
_
(
BTrees
.
family32
.
minint
in
s
)
self
.
assert
True
(
BTrees
.
family32
.
minint
in
s
)
s
=
IOTreeSet
()
s
=
IOTreeSet
()
# this next bit illustrates an, um, "interesting feature". If
# this next bit illustrates an, um, "interesting feature". If
# the characteristics change to match the 64 bit version, please
# the characteristics change to match the 64 bit version, please
...
@@ -460,22 +460,22 @@ class FamilyTest(unittest.TestCase):
...
@@ -460,22 +460,22 @@ class FamilyTest(unittest.TestCase):
import
BTrees
import
BTrees
from
BTrees.LOBTree
import
LOTreeSet
from
BTrees.LOBTree
import
LOTreeSet
verifyObject
(
BTrees
.
Interfaces
.
IBTreeFamily
,
BTrees
.
family64
)
verifyObject
(
BTrees
.
Interfaces
.
IBTreeFamily
,
BTrees
.
family64
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family64
.
IO
,
BTrees
.
LOBTree
)
BTrees
.
family64
.
IO
,
BTrees
.
LOBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family64
.
OI
,
BTrees
.
OLBTree
)
BTrees
.
family64
.
OI
,
BTrees
.
OLBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family64
.
II
,
BTrees
.
LLBTree
)
BTrees
.
family64
.
II
,
BTrees
.
LLBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family64
.
IF
,
BTrees
.
LFBTree
)
BTrees
.
family64
.
IF
,
BTrees
.
LFBTree
)
self
.
assertEqual
s
(
self
.
assertEqual
(
BTrees
.
family64
.
OO
,
BTrees
.
OOBTree
)
BTrees
.
family64
.
OO
,
BTrees
.
OOBTree
)
s
=
LOTreeSet
()
s
=
LOTreeSet
()
s
.
insert
(
BTrees
.
family64
.
maxint
)
s
.
insert
(
BTrees
.
family64
.
maxint
)
self
.
assert
_
(
BTrees
.
family64
.
maxint
in
s
)
self
.
assert
True
(
BTrees
.
family64
.
maxint
in
s
)
s
=
LOTreeSet
()
s
=
LOTreeSet
()
s
.
insert
(
BTrees
.
family64
.
minint
)
s
.
insert
(
BTrees
.
family64
.
minint
)
self
.
assert
_
(
BTrees
.
family64
.
minint
in
s
)
self
.
assert
True
(
BTrees
.
family64
.
minint
in
s
)
s
=
LOTreeSet
()
s
=
LOTreeSet
()
# XXX why oh why do we expect ValueError here, but TypeError in test32?
# XXX why oh why do we expect ValueError here, but TypeError in test32?
self
.
assertRaises
(
ValueError
,
s
.
insert
,
BTrees
.
family64
.
maxint
+
1
)
self
.
assertRaises
(
ValueError
,
s
.
insert
,
BTrees
.
family64
.
maxint
+
1
)
...
...
BTrees/tests/testConflict.py
View file @
9ec6660f
...
@@ -332,10 +332,10 @@ class NastyConfictFunctionalTests(ConflictTestBase, unittest.TestCase):
...
@@ -332,10 +332,10 @@ class NastyConfictFunctionalTests(ConflictTestBase, unittest.TestCase):
state1
=
bucket
.
__getstate__
()
state1
=
bucket
.
__getstate__
()
state2
=
bucket
.
__getstate__
()
state2
=
bucket
.
__getstate__
()
state3
=
bucket
.
__getstate__
()
state3
=
bucket
.
__getstate__
()
self
.
assert
_
(
state2
is
not
state1
and
self
.
assert
True
(
state2
is
not
state1
and
state2
is
not
state3
and
state2
is
not
state3
and
state3
is
not
state1
)
state3
is
not
state1
)
self
.
assert
_
(
state2
==
state1
and
self
.
assert
True
(
state2
==
state1
and
state3
==
state1
)
state3
==
state1
)
self
.
assertRaises
(
BTreesConflictError
,
bucket
.
_p_resolveConflict
,
self
.
assertRaises
(
BTreesConflictError
,
bucket
.
_p_resolveConflict
,
state1
,
state2
,
state3
)
state1
,
state2
,
state3
)
...
...
BTrees/tests/test_Length.py
View file @
9ec6660f
...
@@ -71,10 +71,10 @@ class LengthTestCase(unittest.TestCase):
...
@@ -71,10 +71,10 @@ class LengthTestCase(unittest.TestCase):
return
return
else
:
#pragma NO COVER Py2
else
:
#pragma NO COVER Py2
self
.
assertEqual
(
length
(),
sys
.
maxint
)
self
.
assertEqual
(
length
(),
sys
.
maxint
)
self
.
assert
_
(
type
(
length
())
is
int
)
self
.
assert
True
(
type
(
length
())
is
int
)
length
.
change
(
+
1
)
length
.
change
(
+
1
)
self
.
assertEqual
(
length
(),
sys
.
maxint
+
1
)
self
.
assertEqual
(
length
(),
sys
.
maxint
+
1
)
self
.
assert
_
(
type
(
length
())
is
long
)
self
.
assert
True
(
type
(
length
())
is
long
)
def
test_change_underflows_to_long
(
self
):
def
test_change_underflows_to_long
(
self
):
import
sys
import
sys
...
@@ -85,10 +85,10 @@ class LengthTestCase(unittest.TestCase):
...
@@ -85,10 +85,10 @@ class LengthTestCase(unittest.TestCase):
else
:
#pragma NO COVER Py2
else
:
#pragma NO COVER Py2
length
=
self
.
_makeOne
(
minint
)
length
=
self
.
_makeOne
(
minint
)
self
.
assertEqual
(
length
(),
minint
)
self
.
assertEqual
(
length
(),
minint
)
self
.
assert
_
(
type
(
length
())
is
int
)
self
.
assert
True
(
type
(
length
())
is
int
)
length
.
change
(
-
1
)
length
.
change
(
-
1
)
self
.
assertEqual
(
length
(),
minint
-
1
)
self
.
assertEqual
(
length
(),
minint
-
1
)
self
.
assert
_
(
type
(
length
())
is
long
)
self
.
assert
True
(
type
(
length
())
is
long
)
def
test___call___no_args
(
self
):
def
test___call___no_args
(
self
):
length
=
self
.
_makeOne
(
42
)
length
=
self
.
_makeOne
(
42
)
...
...
BTrees/tests/test_btreesubclass.py
View file @
9ec6660f
...
@@ -38,7 +38,7 @@ class SubclassTest(unittest.TestCase):
...
@@ -38,7 +38,7 @@ class SubclassTest(unittest.TestCase):
t
[
i
]
=
i
t
[
i
]
=
i
state
=
t
.
__getstate__
()
state
=
t
.
__getstate__
()
self
.
assert
_
(
state
[
0
][
0
].
__class__
is
B
)
self
.
assert
True
(
state
[
0
][
0
].
__class__
is
B
)
def
test_suite
():
def
test_suite
():
return
unittest
.
makeSuite
(
SubclassTest
)
return
unittest
.
makeSuite
(
SubclassTest
)
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