Ejemplo n.º 1
0
def latter_description():
    latter = {
        "Name": "Konstantin",
        "Later": "Hello {Name},\n"
                 "I'm a test latter for you.\n\n"
                 "Kind Regards,\n"
                 "{Name}\n"
    }
    print substitute(latter, latter)['Later']
Ejemplo n.º 2
0
def test_sub_self_dict():
    d = {'a': '{b}', 'b': 'c'}
    eq_(
        substitute(d, d),
        {'a': 'c', 'b': 'c'},
        "Self substitution"
    )
Ejemplo n.º 3
0
def test_sub_two_inner_dict():
    eq_(
        substitute({'a': {'a': "{a}"}}, {'a': 't'}),
        {'a': {'a': "t"}},
        "Inner dict handled"
    )
Ejemplo n.º 4
0
def test_sub_several_in_one_val():
    eq_(
        substitute({'a': "{h}+{h}+{a}"}, {'a': 't', 'h': "d"}),
        {'a': "d+d+t"},
        "Several substitution in one value"
    )
Ejemplo n.º 5
0
def test_sub_simple_dict():
    eq_(
        substitute({'a': "{h}"}, {'h': "d"}),
        {'a': "d"},
        "Simple string substitution"
    )
Ejemplo n.º 6
0
def test_sub_empty_dict():
    eq_(
        substitute({'a': "{h}"}, {}),
        {'a': "{h}"},
        "Substitute empty dict doesn't change anything"
    )