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
Kirill Smelkov
ZODB
Commits
3d3f35a9
Commit
3d3f35a9
authored
Jun 23, 2002
by
Tim Peters
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added some set operation tests on sets big enough to require more than
one bucket.
parent
8514e263
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
0 deletions
+27
-0
src/BTrees/tests/testSetOps.py
src/BTrees/tests/testSetOps.py
+27
-0
No files found.
src/BTrees/tests/testSetOps.py
View file @
3d3f35a9
...
@@ -145,6 +145,33 @@ class SetResult(TestCase):
...
@@ -145,6 +145,33 @@ class SetResult(TestCase):
else
:
else
:
self
.
assertEqual
(
list
(
C
),
want
)
self
.
assertEqual
(
list
(
C
),
want
)
def
testLargerInputs
(
self
):
from
random
import
randint
MAXSIZE
=
200
MAXVAL
=
400
for
i
in
range
(
3
):
n
=
randint
(
0
,
MAXSIZE
)
Akeys
=
[
randint
(
1
,
MAXVAL
)
for
j
in
range
(
n
)]
As
=
[
makeset
(
Akeys
)
for
makeset
in
self
.
builders
]
Akeys
=
IISet
(
Akeys
)
n
=
randint
(
0
,
MAXSIZE
)
Bkeys
=
[
randint
(
1
,
MAXVAL
)
for
j
in
range
(
n
)]
Bs
=
[
makeset
(
Bkeys
)
for
makeset
in
self
.
builders
]
Bkeys
=
IISet
(
Bkeys
)
for
op
,
simulator
in
((
self
.
union
,
self
.
_union
),
(
self
.
intersection
,
self
.
_intersection
),
(
self
.
difference
,
self
.
_difference
)):
for
A
in
As
:
for
B
in
Bs
:
got
=
op
(
A
,
B
)
want
=
simulator
(
Akeys
,
Bkeys
)
self
.
assertEqual
(
list
(
got
.
keys
()),
want
,
(
A
,
B
,
Akeys
,
Bkeys
,
list
(
got
.
keys
()),
want
))
# Given a mapping builder (IIBTree, OOBucket, etc), return a function
# Given a mapping builder (IIBTree, OOBucket, etc), return a function
# that builds an object of that type given only a list of keys.
# that builds an object of that type given only a list of keys.
def
makeBuilder
(
mapbuilder
):
def
makeBuilder
(
mapbuilder
):
...
...
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