Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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')
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')
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')
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')
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')
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')
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')
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)