Commit 70b4b71c authored by Kirill Smelkov's avatar Kirill Smelkov

amari.xlog: Test and polish str(LogSpec)

If the parsed period was '60s' we were printing it back as '60.0s' on str.
Fix it by using %g insted of %s.
parent ce383492
......@@ -96,7 +96,7 @@ class LogSpec:
spec.period = period
def __str__(spec):
return "%s[%s]/%ss" % (spec.query, ','.join(spec.optv), spec.period)
return "%s[%s]/%gs" % (spec.query, ','.join(spec.optv), spec.period)
# LogSpec.parse parses text into LogSpec.
@staticmethod
......
......@@ -306,6 +306,7 @@ def test_LogSpec():
assert spec.query == "stats"
assert spec.optv == ["samples", "rf"]
assert spec.period == 60.0
assert str(spec) == logspec
def test_ReverseLineReader():
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment