Exemplo n.º 1
0
def test_to_iso8601_duration():
    with pytest.raises(click.UsageError):
        to_iso8601_duration("")

    with pytest.raises(click.UsageError):
        to_iso8601_duration(None)

    with pytest.raises(click.UsageError):
        to_iso8601_duration("foo")

    with pytest.raises(click.UsageError):
        to_iso8601_duration("5s16h")

    assert to_iso8601_duration("5m") == "PT5M"
    assert to_iso8601_duration("5H4s") == "PT5H4S"
Exemplo n.º 2
0
def test_to_iso8601_duration():
    with pytest.raises(click.UsageError):
        to_iso8601_duration("")

    with pytest.raises(click.UsageError):
        to_iso8601_duration(None)

    with pytest.raises(click.UsageError):
        to_iso8601_duration("foo")

    with pytest.raises(click.UsageError):
        to_iso8601_duration("5s16h")

    assert to_iso8601_duration("5m") == "PT5M"
    assert to_iso8601_duration("5H4s") == "PT5H4S"