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
4fd37b0d
Commit
4fd37b0d
authored
Nov 13, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Test pure-Python II entities everywhere.
parent
03b23ae6
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
232 additions
and
8 deletions
+232
-8
BTrees/check.py
BTrees/check.py
+1
-0
BTrees/tests/test_IIBTree.py
BTrees/tests/test_IIBTree.py
+231
-8
No files found.
BTrees/check.py
View file @
4fd37b0d
...
...
@@ -35,6 +35,7 @@ that doesn't exist in the actual BTree).
from
BTrees.IFBTree
import
IFBTree
,
IFBucket
,
IFSet
,
IFTreeSet
from
BTrees.IFBTree
import
IFBTreePy
,
IFBucketPy
,
IFSetPy
,
IFTreeSetPy
from
BTrees.IIBTree
import
IIBTree
,
IIBucket
,
IISet
,
IITreeSet
from
BTrees.IIBTree
import
IIBTreePy
,
IIBucketPy
,
IISetPy
,
IITreeSetPy
from
BTrees.IOBTree
import
IOBTree
,
IOBucket
,
IOSet
,
IOTreeSet
from
BTrees.LFBTree
import
LFBTree
,
LFBucket
,
LFSet
,
LFTreeSet
from
BTrees.LLBTree
import
LLBTree
,
LLBucket
,
LLSet
,
LLTreeSet
...
...
BTrees/tests/test_IIBTree.py
View file @
4fd37b0d
...
...
@@ -40,6 +40,13 @@ class IIBTreeInternalKeyTest(InternalKeysMappingTest, unittest.TestCase):
return
IIBTree
class
IIBTreePyInternalKeyTest
(
InternalKeysMappingTest
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
return
IIBTreePy
class
IITreeSetInternalKeyTest
(
InternalKeysSetTest
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -47,6 +54,13 @@ class IITreeSetInternalKeyTest(InternalKeysSetTest, unittest.TestCase):
return
IITreeSet
class
IITreeSetPyInternalKeyTest
(
InternalKeysSetTest
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IITreeSetPy
return
IITreeSetPy
class
IIBucketTest
(
MappingBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -54,6 +68,13 @@ class IIBucketTest(MappingBase, unittest.TestCase):
return
IIBucket
class
IIBucketPyTest
(
MappingBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IIBucketPy
return
IIBucketPy
class
IITreeSetTest
(
NormalSetTests
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -61,6 +82,13 @@ class IITreeSetTest(NormalSetTests, unittest.TestCase):
return
IITreeSet
class
IITreeSetPyTest
(
NormalSetTests
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IITreeSetPy
return
IITreeSetPy
class
IISetTest
(
ExtendedSetTests
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -68,11 +96,14 @@ class IISetTest(ExtendedSetTests, unittest.TestCase):
return
IISet
class
IIBTreeTest
(
BTreeTests
,
unittest
.
TestCase
):
class
IISetPyTest
(
ExtendedSetTests
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IISetPy
return
IISetPy
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTree
return
IIBTree
()
class
_IIBTreeTestBase
(
BTreeTests
):
def
testIIBTreeOverflow
(
self
):
good
=
set
()
...
...
@@ -97,22 +128,44 @@ class IIBTreeTest(BTreeTests, unittest.TestCase):
self
.
assertEqual
(
sorted
(
good
),
sorted
(
b
))
class
IIBTreeTest
(
_IIBTreeTestBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTree
return
IIBTree
()
class
IIBTreeTestPy
(
_IIBTreeTestBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
return
IIBTreePy
()
if
using64bits
:
class
IIBTreeTest
(
BTreeTests
,
TestLongIntKeys
,
TestLongIntValues
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTree
return
IIBTree
()
def
getTwoValues
(
self
):
return
1
,
2
class
TestIIBTrees
(
unittest
.
TestCase
):
class
IIBTreeTest
(
BTreeTests
,
TestLongIntKeys
,
TestLongIntValues
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTree
return
IIBTree
()
from
BTrees.IIBTree
import
IIBTreePy
return
IIBTreePy
()
def
getTwoValues
(
self
):
return
1
,
2
class
_TestIIBTreesBase
(
object
):
def
testNonIntegerKeyRaises
(
self
):
self
.
assertRaises
(
TypeError
,
self
.
_stringraiseskey
)
...
...
@@ -143,6 +196,20 @@ class TestIIBTrees(unittest.TestCase):
self
.
_makeOne
()[
1
]
=
None
class
TestIIBTrees
(
_TestIIBTreesBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTree
return
IIBTree
()
class
TestIIBTreesPy
(
_TestIIBTreesBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
return
IIBTreePy
()
class
TestIISets
(
I_SetsBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
...
...
@@ -150,6 +217,13 @@ class TestIISets(I_SetsBase, unittest.TestCase):
return
IISet
()
class
TestIISetsPy
(
I_SetsBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IISetPy
return
IISetPy
()
class
TestIITreeSets
(
I_SetsBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
...
...
@@ -157,16 +231,27 @@ class TestIITreeSets(I_SetsBase, unittest.TestCase):
return
IITreeSet
()
class
TestIITreeSetsPy
(
I_SetsBase
,
unittest
.
TestCase
):
def
_makeOne
(
self
):
from
BTrees.IIBTree
import
IITreeSetPy
return
IITreeSetPy
()
class
PureII
(
SetResult
,
unittest
.
TestCase
):
def
union
(
self
,
*
args
):
from
BTrees.IIBTree
import
union
return
union
(
*
args
)
def
intersection
(
self
,
*
args
):
from
BTrees.IIBTree
import
intersection
return
intersection
(
*
args
)
def
difference
(
self
,
*
args
):
from
BTrees.IIBTree
import
difference
return
difference
(
*
args
)
def
builders
(
self
):
from
BTrees.IIBTree
import
IIBTree
from
BTrees.IIBTree
import
IIBucket
...
...
@@ -175,42 +260,105 @@ class PureII(SetResult, unittest.TestCase):
return
IISet
,
IITreeSet
,
makeBuilder
(
IIBTree
),
makeBuilder
(
IIBucket
)
class
PureIIPy
(
SetResult
,
unittest
.
TestCase
):
def
union
(
self
,
*
args
):
from
BTrees.IIBTree
import
unionPy
return
unionPy
(
*
args
)
def
intersection
(
self
,
*
args
):
from
BTrees.IIBTree
import
intersectionPy
return
intersectionPy
(
*
args
)
def
difference
(
self
,
*
args
):
from
BTrees.IIBTree
import
differencePy
return
differencePy
(
*
args
)
def
builders
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
from
BTrees.IIBTree
import
IIBucketPy
from
BTrees.IIBTree
import
IITreeSetPy
from
BTrees.IIBTree
import
IISetPy
return
(
IISetPy
,
IITreeSetPy
,
makeBuilder
(
IIBTreePy
),
makeBuilder
(
IIBucketPy
))
class
TestIIMultiUnion
(
MultiUnion
,
unittest
.
TestCase
):
def
multiunion
(
self
,
*
args
):
from
BTrees.IIBTree
import
multiunion
return
multiunion
(
*
args
)
def
union
(
self
,
*
args
):
from
BTrees.IIBTree
import
union
return
union
(
*
args
)
def
mkset
(
self
,
*
args
):
from
BTrees.IIBTree
import
IISet
as
mkset
return
mkset
(
*
args
)
def
mktreeset
(
self
,
*
args
):
from
BTrees.IIBTree
import
IITreeSet
as
mktreeset
return
mktreeset
(
*
args
)
def
mkbucket
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBucket
as
mkbucket
return
mkbucket
(
*
args
)
def
mkbtree
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBTree
as
mkbtree
return
mkbtree
(
*
args
)
class
TestIIMultiUnionPy
(
MultiUnion
,
unittest
.
TestCase
):
def
multiunion
(
self
,
*
args
):
from
BTrees.IIBTree
import
multiunionPy
return
multiunionPy
(
*
args
)
def
union
(
self
,
*
args
):
from
BTrees.IIBTree
import
unionPy
return
unionPy
(
*
args
)
def
mkset
(
self
,
*
args
):
from
BTrees.IIBTree
import
IISetPy
as
mkset
return
mkset
(
*
args
)
def
mktreeset
(
self
,
*
args
):
from
BTrees.IIBTree
import
IITreeSetPy
as
mktreeset
return
mktreeset
(
*
args
)
def
mkbucket
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBucketPy
as
mkbucket
return
mkbucket
(
*
args
)
def
mkbtree
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBTreePy
as
mkbtree
return
mkbtree
(
*
args
)
class
TestWeightedII
(
Weighted
,
unittest
.
TestCase
):
def
weightedUnion
(
self
):
from
BTrees.IIBTree
import
weightedUnion
return
weightedUnion
def
weightedIntersection
(
self
):
from
BTrees.IIBTree
import
weightedIntersection
return
weightedIntersection
def
union
(
self
):
from
BTrees.IIBTree
import
union
return
union
def
intersection
(
self
):
from
BTrees.IIBTree
import
intersection
return
intersection
def
mkbucket
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBucket
as
mkbucket
return
mkbucket
(
*
args
)
def
builders
(
self
):
from
BTrees.IIBTree
import
IIBTree
from
BTrees.IIBTree
import
IIBucket
...
...
@@ -219,6 +367,37 @@ class TestWeightedII(Weighted, unittest.TestCase):
return
IIBucket
,
IIBTree
,
itemsToSet
(
IISet
),
itemsToSet
(
IITreeSet
)
class
TestWeightedIIPy
(
Weighted
,
unittest
.
TestCase
):
def
weightedUnion
(
self
):
from
BTrees.IIBTree
import
weightedUnionPy
return
weightedUnionPy
def
weightedIntersection
(
self
):
from
BTrees.IIBTree
import
weightedIntersectionPy
return
weightedIntersectionPy
def
union
(
self
):
from
BTrees.IIBTree
import
unionPy
return
unionPy
def
intersection
(
self
):
from
BTrees.IIBTree
import
intersectionPy
return
intersectionPy
def
mkbucket
(
self
,
*
args
):
from
BTrees.IIBTree
import
IIBucketPy
as
mkbucket
return
mkbucket
(
*
args
)
def
builders
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
from
BTrees.IIBTree
import
IIBucketPy
from
BTrees.IIBTree
import
IITreeSetPy
from
BTrees.IIBTree
import
IISetPy
return
(
IIBucketPy
,
IIBTreePy
,
itemsToSet
(
IISetPy
),
itemsToSet
(
IITreeSetPy
))
class
IIBTreeConflictTests
(
MappingConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -226,6 +405,13 @@ class IIBTreeConflictTests(MappingConflictTestBase, unittest.TestCase):
return
IIBTree
class
IIBTreeConflictTestsPy
(
MappingConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IIBTreePy
return
IIBTreePy
class
IIBucketConflictTests
(
MappingConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -233,6 +419,13 @@ class IIBucketConflictTests(MappingConflictTestBase, unittest.TestCase):
return
IIBucket
class
IIBucketConflictTestsPy
(
MappingConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IIBucketPy
return
IIBucketPy
class
IITreeSetConflictTests
(
SetConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -240,6 +433,13 @@ class IITreeSetConflictTests(SetConflictTestBase, unittest.TestCase):
return
IITreeSet
class
IITreeSetConflictTestsPy
(
SetConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IITreeSetPy
return
IITreeSetPy
class
IISetConflictTests
(
SetConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
...
...
@@ -247,6 +447,13 @@ class IISetConflictTests(SetConflictTestBase, unittest.TestCase):
return
IISet
class
IISetConflictTestsPy
(
SetConflictTestBase
,
unittest
.
TestCase
):
def
_getTargetClass
(
self
):
from
BTrees.IIBTree
import
IISetPy
return
IISetPy
class
IIModuleTest
(
ModuleTest
,
unittest
.
TestCase
):
prefix
=
'II'
...
...
@@ -263,20 +470,36 @@ class IIModuleTest(ModuleTest, unittest.TestCase):
def
test_suite
():
return
unittest
.
TestSuite
((
unittest
.
makeSuite
(
IIBTreeInternalKeyTest
),
unittest
.
makeSuite
(
IIBTreePyInternalKeyTest
),
unittest
.
makeSuite
(
IITreeSetInternalKeyTest
),
unittest
.
makeSuite
(
IITreeSetPyInternalKeyTest
),
unittest
.
makeSuite
(
IIBucketTest
),
unittest
.
makeSuite
(
IIBucketPyTest
),
unittest
.
makeSuite
(
IITreeSetTest
),
unittest
.
makeSuite
(
IITreeSetPyTest
),
unittest
.
makeSuite
(
IISetTest
),
unittest
.
makeSuite
(
IISetPyTest
),
unittest
.
makeSuite
(
IIBTreeTest
),
unittest
.
makeSuite
(
IIBTreeTestPy
),
unittest
.
makeSuite
(
TestIIBTrees
),
unittest
.
makeSuite
(
TestIIBTreesPy
),
unittest
.
makeSuite
(
TestIISets
),
unittest
.
makeSuite
(
TestIISetsPy
),
unittest
.
makeSuite
(
TestIITreeSets
),
unittest
.
makeSuite
(
TestIITreeSetsPy
),
unittest
.
makeSuite
(
TestIIMultiUnion
),
unittest
.
makeSuite
(
TestIIMultiUnionPy
),
unittest
.
makeSuite
(
PureII
),
unittest
.
makeSuite
(
PureIIPy
),
unittest
.
makeSuite
(
TestWeightedII
),
unittest
.
makeSuite
(
TestWeightedIIPy
),
unittest
.
makeSuite
(
IIBTreeConflictTests
),
unittest
.
makeSuite
(
IIBTreeConflictTestsPy
),
unittest
.
makeSuite
(
IIBucketConflictTests
),
unittest
.
makeSuite
(
IIBucketConflictTestsPy
),
unittest
.
makeSuite
(
IITreeSetConflictTests
),
unittest
.
makeSuite
(
IITreeSetConflictTestsPy
),
unittest
.
makeSuite
(
IISetConflictTests
),
unittest
.
makeSuite
(
IISetConflictTestsPy
),
unittest
.
makeSuite
(
IIModuleTest
),
))
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