예제 #1
0
def test_get_processed_string_no_interpolation():
    """get_processed_string on plain string returns plain."""
    context = Context({
        'ctx1': 'ctxvalue1',
        'ctx2': 'ctxvalue2',
        'ctx3': 'ctxvalue3',
        'ctx4': 'ctxvalue4'
    })

    input_string = 'test string here'

    output = context.get_processed_string(input_string)

    assert input_string == output
예제 #2
0
def test_get_processed_string_shorter_than_6_no_interpolation():
    context = Context()
    input_string = 'k'
    output = context.get_processed_string(input_string)
    assert output == 'k', ("string interpolation incorrect")
예제 #3
0
def test_get_processed_string_sic_skips_interpolation():
    context = Context({'key1': 'down', 'key2': 'valleys', 'key3': 'value3'})
    input_string = '[sic]"Piping {key1} the {key2} wild"'
    output = context.get_processed_string(input_string)
    assert output == 'Piping {key1} the {key2} wild', (
        "string interpolation incorrect")
예제 #4
0
def test_get_processed_string_shorter_than_6_with_interpolation():
    context = Context({'k': 'down', 'key2': 'valleys', 'key3': 'value3'})
    input_string = '{k}'
    output = context.get_processed_string(input_string)
    assert output == 'down', ("string interpolation incorrect")