Skip to content

Commit

Permalink
add some test cases of anyconfig.mergeabledict not covered
Browse files Browse the repository at this point in the history
  • Loading branch information
ssato committed Oct 3, 2014
1 parent a37e045 commit a36b90b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions anyconfig/tests/mergeabledict.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ def test_update__w_merge_dicts(self):

def test_update__w_merge_dicts_and_lists(self):
a = T.MergeableDict(name="a", a=1, b=T.MergeableDict(b=[1, 2], c="C"))
b = T.MergeableDict(a=2, b=T.MergeableDict(b=[3, 4, 5], d="D"))
b = T.MergeableDict(a=2, b=T.MergeableDict(b=[3, 4], d="D", e=[1, 2]))

ref = T.MergeableDict(**a.copy())
ref['a'] = 2
ref['b'] = T.MergeableDict(b=[1, 2, 3, 4, 5], c="C", d="D")
ref['b'] = T.MergeableDict(b=[1, 2, 3, 4], c="C", d="D", e=[1, 2])

a.update(b, T.MS_DICTS_AND_LISTS)

Expand All @@ -56,9 +56,15 @@ def test_update__w_replace(self):
ref['b']['c'] = a['b']['c']

a.update(b, T.MS_REPLACE)

self.assertEquals(a, ref)

def test_update__w_replace__not_a_dict(self):
a = T.MergeableDict()
a.update(1, T.MS_REPLACE)

# FIXME: It does not work.
# self.assertEquals(a, 1)

def test_update__wo_replace(self):
a = T.MergeableDict(a=1, b=T.MergeableDict(b=[1, 2], c="C"))
b = T.MergeableDict(name="foo", a=2,
Expand Down

0 comments on commit a36b90b

Please sign in to comment.