예제 #1
0
def test_add_headers_should_raise_ValueError_if_number_of_blanks_differ_from_number_of_headers():
    t = Templater(template='|||<u>|||</u>|||', marker='|||')
    try:
        t.add_headers(['one', 'two', 'three', 'four'])
    except ValueError:
        pass
    else:
        assert 'ValueError not raised!' == False
예제 #2
0
def test_should_be_able_to_add_headers_to_a_template_without_named_markers():
    t = Templater(template='|||<u>|||</u>|||', marker='|||')
    t.add_headers(['one', 'two', 'three'])
    result = t.parse('a<u>b</u>c')
    expected = {'one': 'a', 'two': 'b', 'three': 'c'}
    assert result == expected
예제 #3
0
def test_should_be_able_to_add_headers_to_a_template_without_named_markers():
    t = Templater(template='|||<u>|||</u>|||', marker='|||')
    t.add_headers(['one', 'two', 'three'])
    result = t.parse('a<u>b</u>c')
    expected = {'one': 'a', 'two': 'b', 'three': 'c'}
    assert result == expected