1#!/usr/bin/env python2.7 -B 2 3import analyze_logs 4 5 6def test_ParseDuration(s, expected): 7 actual = analyze_logs.ParseDuration(s) 8 if actual != expected: 9 raise Exception("expected %s, actual %s" % (expected, actual)) 10 11def main(): 12 test_ParseDuration("1w", 604800) 13 test_ParseDuration("1d", 86400) 14 test_ParseDuration("1h", 3600) 15 test_ParseDuration("1m", 60) 16 test_ParseDuration("1s", 1) 17 test_ParseDuration("1w1d1h1m1s", 694861) 18 19 20if __name__ == "__main__": 21 main() 22 23 24# vim: set ts=2 sw=2 sts=2 tw=100 nocindent autoindent smartindent expandtab : 25