Skip to content

Commit

Permalink
Add unit tests for merging dict and list
Browse files Browse the repository at this point in the history
  • Loading branch information
kkaarreell committed Nov 19, 2024
1 parent dbebab8 commit 9fc47a2
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions tests/unit/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,22 @@ def test_merge_plus(self):
with pytest.raises(utils.MergeError):
child.data["time+"] = "string"
child.inherit()
child = self.merge.find('/parent_dict/path')
assert len(child.data['discover']) == 2
assert child.data['discover'][0]['how'] == 'fmf'
assert child.data['discover'][0]['name'] == 'upstream'
assert child.data['discover'][0]['url'] == 'https://some.url'
assert child.data['discover'][1]['how'] == 'fmf'
assert child.data['discover'][1]['name'] == 'downstream'
assert child.data['discover'][1]['url'] == 'https://other.url'
for i in [1, 2]:
child = self.merge.find(f'/parent_list/tier{i}')
assert child.data['summary'] == 'basic tests' if i == 1 else 'detailed tests'
assert len(child.data['discover']) == 2
assert child.data['discover'][0]['filter'] == f'tier: {i}'
assert child.data['discover'][0]['url'] == 'https://github.com/project1'
assert child.data['discover'][1]['filter'] == f'tier: {i}'
assert child.data['discover'][1]['url'] == 'https://github.com/project2'

def test_merge_minus(self):
""" Reducing attributes using the '-' suffix """
Expand Down

0 comments on commit 9fc47a2

Please sign in to comment.