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
eb161007
Commit
eb161007
authored
Nov 18, 2012
by
Tres Seaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Coverage for Set.
parent
27c31e1d
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
82 additions
and
2 deletions
+82
-2
BTrees/tests/test__base.py
BTrees/tests/test__base.py
+82
-2
No files found.
BTrees/tests/test__base.py
View file @
eb161007
...
...
@@ -1276,15 +1276,95 @@ class SetTests(unittest.TestCase):
_set
.
_p_resolveConflict
,
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
e
.
reason
,
9
)
def
test__p_resolveConflict_ok_both_add_new_max
(
self
):
def
test__p_resolveConflict_ok_insert_in_new_add_in_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'c'
),
None
)
s_com
=
((
'a'
,
'c'
,
'd'
),
None
)
s_new
=
((
'a'
,
'b'
,
'c'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
# Note that _SetBase uses default __getstate__
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_insert_in_com_add_in_new
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'c'
),
None
)
s_com
=
((
'a'
,
'b'
,
'c'
),
None
)
s_new
=
((
'a'
,
'c'
,
'd'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_delete_in_new_add_in_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'b'
,
'c'
),
None
)
s_com
=
((
'a'
,
'b'
,
'c'
,
'd'
),
None
)
s_new
=
((
'a'
,
'c'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_delete_in_com_add_in_new
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'b'
,
'c'
),
None
)
s_com
=
((
'a'
,
'c'
),
None
)
s_new
=
((
'a'
,
'b'
,
'c'
,
'd'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_add_new_lt_add_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,),
None
)
s_com
=
((
'a'
,
'd'
),
None
)
s_new
=
((
'a'
,
'b'
,
'c'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_add_com_lt_add_new
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,),
None
)
s_com
=
((
'a'
,
'b'
,
'c'
),
None
)
s_new
=
((
'a'
,
'd'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
# Note that _SetBase uses default __getstate__
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_ins_in_com_del_add_in_new
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'c'
),
None
)
s_com
=
((
'a'
,
'b'
,
'c'
),
None
)
s_new
=
((
'a'
,
'd'
,
'e'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'd'
,
'e'
),))
def
test__p_resolveConflict_ok_ins_in_new_del_add_in_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'c'
),
None
)
s_com
=
((
'a'
,
'd'
,
'e'
),
None
)
s_new
=
((
'a'
,
'b'
,
'c'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'd'
,
'e'
),))
def
test__p_resolveConflict_ok_ins_both_new_lt_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'e'
),
None
)
s_com
=
((
'a'
,
'c'
,
'd'
,
'e'
),
None
)
s_new
=
((
'a'
,
'b'
,
'e'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'b'
,
'c'
,
'd'
,
'e'
),))
def
test__p_resolveConflict_ok_del_new_add_com
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'e'
),
None
)
s_com
=
((
'a'
,
'c'
,
'd'
,
'e'
),
None
)
s_new
=
((
'a'
,),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_ok_del_com_add_new
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'e'
),
None
)
s_com
=
((
'a'
,),
None
)
s_new
=
((
'a'
,
'c'
,
'd'
,
'e'
),
None
)
result
=
_set
.
_p_resolveConflict
(
s_old
,
s_com
,
s_new
)
self
.
assertEqual
(
result
,
((
'a'
,
'c'
,
'd'
),))
def
test__p_resolveConflict_add_new_gt_old_com_lt_old
(
self
):
_set
=
self
.
_makeOne
()
s_old
=
((
'a'
,
'b'
,
'c'
),
None
)
...
...
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