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
298c6e78
Commit
298c6e78
authored
Dec 04, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for BTrees._base.union.
parent
ea252991
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
57 additions
and
20 deletions
+57
-20
BTrees/tests/test__base.py
BTrees/tests/test__base.py
+57
-20
No files found.
BTrees/tests/test__base.py
View file @
298c6e78
...
@@ -2436,44 +2436,44 @@ class Test_difference(unittest.TestCase, _SetObBase):
...
@@ -2436,44 +2436,44 @@ class Test_difference(unittest.TestCase, _SetObBase):
def
test_both_sets_rhs_empty
(
self
):
def
test_both_sets_rhs_empty
(
self
):
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
rhs
=
self
.
_makeSet
()
rhs
=
self
.
_makeSet
()
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
list
(
lhs
))
self
.
assertEqual
(
list
(
result
),
list
(
lhs
))
def
test_both_sets_lhs_empty
(
self
):
def
test_both_sets_lhs_empty
(
self
):
lhs
=
self
.
_makeSet
()
lhs
=
self
.
_makeSet
()
rhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
rhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
list
(
lhs
))
self
.
assertEqual
(
list
(
result
),
list
(
lhs
))
def
test_lhs_set_rhs_mapping
(
self
):
def
test_lhs_set_rhs_mapping
(
self
):
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
rhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
})
rhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
})
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
[
'c'
])
self
.
assertEqual
(
list
(
result
),
[
'c'
])
def
test_lhs_mapping_rhs_set
(
self
):
def
test_lhs_mapping_rhs_set
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
rhs
=
self
.
_makeSet
(
'a'
,
'b'
)
rhs
=
self
.
_makeSet
(
'a'
,
'b'
)
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
[
'c'
])
self
.
assertEqual
(
list
(
result
),
[
'c'
])
self
.
assertEqual
(
diff
[
'c'
],
11
)
self
.
assertEqual
(
result
[
'c'
],
11
)
def
test_both_mappings_rhs_empty
(
self
):
def
test_both_mappings_rhs_empty
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
rhs
=
self
.
_makeMapping
({})
rhs
=
self
.
_makeMapping
({})
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
[
'a'
,
'b'
,
'c'
])
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'b'
,
'c'
])
self
.
assertEqual
(
diff
[
'a'
],
13
)
self
.
assertEqual
(
result
[
'a'
],
13
)
self
.
assertEqual
(
diff
[
'b'
],
12
)
self
.
assertEqual
(
result
[
'b'
],
12
)
self
.
assertEqual
(
diff
[
'c'
],
11
)
self
.
assertEqual
(
result
[
'c'
],
11
)
def
test_both_mappings_rhs_non_empty
(
self
):
def
test_both_mappings_rhs_non_empty
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
rhs
=
self
.
_makeMapping
({
'b'
:
22
})
rhs
=
self
.
_makeMapping
({
'b'
:
22
})
diff
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
diff
),
[
'a'
,
'c'
])
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'c'
])
self
.
assertEqual
(
diff
[
'a'
],
13
)
self
.
assertEqual
(
result
[
'a'
],
13
)
self
.
assertEqual
(
diff
[
'c'
],
11
)
self
.
assertEqual
(
result
[
'c'
],
11
)
class
Test_union
(
unittest
.
TestCase
,
_SetObBase
):
class
Test_union
(
unittest
.
TestCase
,
_SetObBase
):
...
@@ -2483,13 +2483,50 @@ class Test_union(unittest.TestCase, _SetObBase):
...
@@ -2483,13 +2483,50 @@ class Test_union(unittest.TestCase, _SetObBase):
return
union
(
*
args
,
**
kw
)
return
union
(
*
args
,
**
kw
)
def
test_lhs_none
(
self
):
def
test_lhs_none
(
self
):
rhs
=
self
.
_makeSet
(
(
'a'
,
'b'
,
'c'
)
)
rhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
self
.
assertEqual
(
self
.
_callFUT
(
rhs
.
__class__
,
None
,
rhs
),
rhs
)
self
.
assertEqual
(
self
.
_callFUT
(
rhs
.
__class__
,
None
,
rhs
),
rhs
)
def
test_rhs_none
(
self
):
def
test_rhs_none
(
self
):
lhs
=
self
.
_makeSet
(
(
'a'
,
'b'
,
'c'
)
)
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
self
.
assertEqual
(
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
None
),
lhs
)
self
.
assertEqual
(
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
None
),
lhs
)
def
test_both_sets_rhs_empty
(
self
):
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
rhs
=
self
.
_makeSet
()
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
result
),
list
(
lhs
))
def
test_both_sets_lhs_empty
(
self
):
lhs
=
self
.
_makeSet
()
rhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
result
),
list
(
rhs
))
def
test_lhs_set_rhs_mapping
(
self
):
lhs
=
self
.
_makeSet
(
'a'
,
'b'
,
'c'
)
rhs
=
self
.
_makeMapping
({
'a'
:
13
,
'd'
:
12
})
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'b'
,
'c'
,
'd'
])
def
test_lhs_mapping_rhs_set
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
rhs
=
self
.
_makeSet
(
'a'
,
'd'
)
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertTrue
(
isinstance
(
result
,
_Set
))
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'b'
,
'c'
,
'd'
])
def
test_both_mappings_rhs_empty
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'b'
:
12
,
'c'
:
11
})
rhs
=
self
.
_makeMapping
({})
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'b'
,
'c'
])
def
test_both_mappings_rhs_non_empty
(
self
):
lhs
=
self
.
_makeMapping
({
'a'
:
13
,
'c'
:
12
,
'e'
:
11
})
rhs
=
self
.
_makeMapping
({
'b'
:
22
,
'd'
:
33
})
result
=
self
.
_callFUT
(
lhs
.
__class__
,
lhs
,
rhs
)
self
.
assertEqual
(
list
(
result
),
[
'a'
,
'b'
,
'c'
,
'd'
,
'e'
])
class
Test_intersection
(
unittest
.
TestCase
,
_SetObBase
):
class
Test_intersection
(
unittest
.
TestCase
,
_SetObBase
):
...
...
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