extend tests

This commit is contained in:
Radovan Bast 2016-05-20 21:32:22 +02:00
parent 24d235ac1a
commit 6cf25bbd2b

View File

@ -33,22 +33,34 @@ def interpolate(d, d_map):
def test_interpolate():
d = {'foo': 'hey',
'bar': 'ho',
'one': 'hey %(foo) ho %(bar)',
'two': {'one': 'hey %(foo) ho %(bar)',
'two': 'raboof'}}
d_interpolated = {'foo': 'hey',
'bar': 'ho',
'one': 'hey hey ho ho',
'two': {'one': 'hey hey ho ho',
'two': 'raboof'}}
assert interpolate(d, d) == d_interpolated
def test_interpolate_int():
d = {'foo': 1,
'bar': 2,
'one': 'hey %(foo) ho %(bar)',
'two': {'one': 'hey %(foo) ho %(bar)',
'two': 'raboof'}}
d_interpolated = {'foo': 1,
'bar': 2,
'one': 'hey 1 ho 2',
'two': {'one': 'hey 1 ho 2',
'two': 'raboof'}}
assert interpolate(d, d) == d_interpolated
def test_interpolate_nested():
d2 = {'modules': [{'fc': [{'source': '%(url_root)fc_optional.cmake'}]}], 'url_root': 'downloaded/downloaded_'}
d2_interpolated = {'modules': [{'fc': [{'source': 'downloaded/downloaded_fc_optional.cmake'}]}], 'url_root': 'downloaded/downloaded_'}
assert interpolate(d2, d2) == d2_interpolated