Exemplo n.º 1
0
def test_parsing_non_parseable_text_should_raise_ValueError():
    text = '<b> testing programming </b>'
    template = ['<b> ', None, ' and ', None, ' </b>']
    try:
        result = _parser(template, text)
    except ValueError:
        pass
    else:
        assert 'ValueError not raised!' == False
Exemplo n.º 2
0
def test_parsing_non_parseable_text_should_raise_ValueError():
    text = '<b> testing programming </b>'
    template = ['<b> ', None, ' and ', None, ' </b>']
    try:
        result = _parser(template, text)
    except ValueError:
        pass
    else:
        assert 'ValueError not raised!' == False
Exemplo n.º 3
0
def test_parsing_template_with_one_blank():
    text = '<b> testing </b>'
    template = [None]
    result = _parser(template, text)
    expected = [text]
    assert result == expected
Exemplo n.º 4
0
def test_parsing_first_blank():
    text = 'blah<b> testing and programming </b>'
    template = [None, '<b> ', None, ' and ', None, ' </b>', None]
    result = _parser(template, text)
    expected = ['blah', 'testing', 'programming', '']
    assert result == expected
Exemplo n.º 5
0
def test_parsing_template_with_three_blanks():
    text = '<b> testing </b>'
    template = [None, '<b> ', None, ' </b>', None]
    result = _parser(template, text)
    expected = ['', 'testing', '']
    assert result == expected
Exemplo n.º 6
0
def test_parsing_template_with_one_blank():
    text = '<b> testing </b>'
    template = [None]
    result = _parser(template, text)
    expected = [text]
    assert result == expected
Exemplo n.º 7
0
def test_parsing_first_blank():
    text = 'blah<b> testing and programming </b>'
    template = [None, '<b> ', None, ' and ', None, ' </b>', None]
    result = _parser(template, text)
    expected = ['blah', 'testing', 'programming', '']
    assert result == expected
Exemplo n.º 8
0
def test_parsing_template_with_three_blanks():
    text = '<b> testing </b>'
    template = [None, '<b> ', None, ' </b>', None]
    result = _parser(template, text)
    expected = ['', 'testing', '']
    assert result == expected