Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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
Esempio 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