예제 #1
0
def test_parse_substitution_error_if_third_element_not_bool():
    """
    Raise a SyntaxError if the third element in the list is not a boolean.
    """
    with pytest.raises(SyntaxError):
        bad_args = ['foo', 'bar', 'intentionally_not_a_bool']
        config.parse_substitution_from_list(bad_args)
예제 #2
0
def test_parse_substitution_from_list_with_is_multiline():
    """
    We should be able to parse a Subsitution if is_multiline is set.
    """
    target = substitute.Substitution('patt', 'repl', True)
    list_rep = ['patt', 'repl', True]
    actual = config.parse_substitution_from_list(list_rep)
    assert_equal(actual, target)
예제 #3
0
def test_parse_substitution_from_list_without_is_multiline():
    """
    Make sure we can parse a list without the is_multiline option set, i.e.
    just a two element list.
    """
    target = substitute.Substitution('foo', 'bar', False)
    list_rep = ['foo', 'bar']
    actual = config.parse_substitution_from_list(list_rep)
    assert_equal(actual, target)
예제 #4
0
def test_parse_substitution_error_if_wrong_length():
    """
    Raise a SyntaxError if the list is less than two long.
    """
    with pytest.raises(SyntaxError):
        config.parse_substitution_from_list(['foo'])
예제 #5
0
def test_parse_substitution_error_if_not_list():
    """
    Raise a SyntaxError if the value is not a list.
    """
    with pytest.raises(SyntaxError):
        config.parse_substitution_from_list('foo_str')