Пример #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
Пример #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
Пример #3
0
def test_parsing_template_with_one_blank():
    text = '<b> testing </b>'
    template = [None]
    result = _parser(template, text)
    expected = [text]
    assert result == expected
Пример #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
Пример #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
Пример #6
0
def test_parsing_template_with_one_blank():
    text = '<b> testing </b>'
    template = [None]
    result = _parser(template, text)
    expected = [text]
    assert result == expected
Пример #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
Пример #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