Ejemplo n.º 1
0
def test_cyclestr_returns_expected_result(E):
    E.text = 'stuff_at_@Y'
    assert tostring(
        cyclestr(E, offset='01:00')
    ) == b'<task><cyclestr offset="01:00">stuff_at_@Y</cyclestr></task>'
Ejemplo n.º 2
0
def test_cyclestr_with_non_string_offset(E):
    with pytest.raises(ValueError, match="offset passed must be of type str"):
        E.text = 'stuff_at_@Y'
        cyclestr(E, offset=1)
Ejemplo n.º 3
0
def test_cyclestr_without_text(E):
    with pytest.raises(ValueError, match="passed element does not have text"):
        cyclestr(E)
Ejemplo n.º 4
0
def test_cyclestr_with_offset_and_no_cyclestr_info(E):
    with pytest.raises(ValueError,
                       match="offset was passed but no '@' in element.text"):
        E.text = 'stuff'
        cyclestr(E, offset='01:00')
Ejemplo n.º 5
0
def test_cyclestr_without_element():
    with pytest.raises(ValueError, match="must be of type Element"):
        cyclestr('not_element')