Пример #1
0
def test_parse_elements_with_spaces():
    elem_str = "elem1, "
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 1
    assert "elem1" == elements[0]

    elem_str = "   elem1,  elem2  "
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 2
    assert "elem1" == elements[0]
    assert "elem2" == elements[1]
def test_parse_elements_with_spaces():
    elem_str = "elem1, "
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 1
    assert "elem1" == elements[0]

    elem_str = "   elem1,  elem2  "
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 2
    assert "elem1" == elements[0]
    assert "elem2" == elements[1]
def test_parse_elements_with_duplicates():
    elem_str = "elem1,elem1"
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements(elem_str)
def test_correct_parse_elements():
    elem_str = "elem1,elem2"
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 2
    assert elements[0] == "elem1"
    assert elements[1] == "elem2"
def test_empty_parse_elements():
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements("")
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements("    ")
Пример #6
0
def test_parse_elements_with_duplicates():
    elem_str = "elem1,elem1"
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements(elem_str)
Пример #7
0
def test_correct_parse_elements():
    elem_str = "elem1,elem2"
    elements = segment_by_segment._parse_elements(elem_str)
    assert len(elements) == 2
    assert elements[0] == "elem1"
    assert elements[1] == "elem2"
Пример #8
0
def test_empty_parse_elements():
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements("")
    with pytest.raises(SbsDefinitionError):
        segment_by_segment._parse_elements("    ")