#!/usr/bin/env python1# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo2# Copyright (C) 2016-2026 German Aerospace Center (DLR) and others.3# This program and the accompanying materials are made available under the4# terms of the Eclipse Public License 2.0 which is available at5# https://www.eclipse.org/legal/epl-2.0/6# This Source Code may also be made available under the following Secondary7# Licenses when the conditions for such availability set forth in the Eclipse8# Public License 2.0 are satisfied: GNU General Public License, version 29# or later which is available at10# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html11# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1213# @file runner.py14# @author Michael Behrisch15# @date 2019-01-091617from __future__ import absolute_import18from __future__ import print_function1920import sys21import os22import unittest2324# Do not use SUMO_HOME here to ensure you are always testing the25# functions from the same tree the test is in26sys.path.append(os.path.join(os.path.dirname(__file__), '..', '..', '..', '..', 'tools'))2728from sumolib import miscutils # noqa293031class Test_Init(unittest.TestCase):3233def test_parseTime(self):34self.assertEqual(42, miscutils.parseTime('00:00:42'))35self.assertEqual(3661, miscutils.parseTime('01:01:01'))36self.assertEqual(25 * 3600 + 61, miscutils.parseTime('1:1:1:1'))37self.assertEqual(-1, miscutils.parseTime('-00:00:01'))3839def test_humanReadableTime(self):40hrt = miscutils.humanReadableTime41self.assertEqual(hrt(42), '00:00:42')42self.assertEqual(hrt(3661), '01:01:01')43self.assertEqual(hrt(25 * 3600 + 61), '1:01:01:01')44self.assertEqual(hrt(-1), '-00:00:01')454647if __name__ == '__main__':48unittest.main()495051