Skip to content

Commit

Permalink
tests: add test for merge with optional substitution(deferred)
Browse files Browse the repository at this point in the history
  • Loading branch information
aalba6675 committed May 3, 2018
1 parent 9ca1bf4 commit f03924c
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions tests/test_config_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -1277,6 +1277,21 @@ def test_substitution_nested_override(self):
assert config['database.name'] == 'peopledb'
assert config['database.pass'] == 'peoplepass'

def test_optional_with_merge(self):
unresolved = ConfigFactory.parse_string(
"""
foo: 42
foo: ${?a}
""", resolve=False)
source = ConfigFactory.parse_string(
"""
b: 14
""")
config = unresolved.with_fallback(source)
assert config['foo'] == 42
config = source.with_fallback(unresolved)
assert config['foo'] == 42

def test_optional_substitution(self):
config = ConfigFactory.parse_string(
"""
Expand Down

0 comments on commit f03924c

Please sign in to comment.