How to use the vaping.config.parse_interval function in vaping

To help you get started, we’ve selected a few vaping examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / tests / test_config.py View on Github external
def test_parse_interval():
    assert 1 == parse_interval('1s')
    assert .5 == parse_interval('500ms')
    assert 300 == parse_interval('5m')
    assert 3600 == parse_interval('1h')
    assert 86400 == parse_interval('1d')

    assert 90 == parse_interval("1m30s")
    assert 90.5 == parse_interval("1m30.5s")
    assert 3661 == parse_interval("1h1m1s")
    assert 86401 == parse_interval("1d1s")
    assert 1800 == parse_interval("0.5h")

    with pytest.raises(ValueError):
        parse_interval('1x')
github 20c / vaping / vaping / plugins / logparse.py View on Github external
def validate_interval(self, value):
        """
        validates a string describing elapsed time or time duration

        **Arguments**

        - value (`str`): elapsed time (example: 1d2h)

        **Returns**

        seconds (`float`)
        """
        return vaping.config.parse_interval(value)