3 # NEPI, a framework to manage network experiments
4 # Copyright (C) 2013 INRIA
6 # This program is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License as published by
8 # the Free Software Foundation, either version 3 of the License, or
9 # (at your option) any later version.
11 # This program is distributed in the hope that it will be useful,
12 # but WITHOUT ANY WARRANTY; without even the implied warranty of
13 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 # GNU General Public License for more details.
16 # You should have received a copy of the GNU General Public License
17 # along with this program. If not, see <http://www.gnu.org/licenses/>.
19 # Author: Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
21 from test_utils import skipIfNotPythonVersion
26 def _get_total_seconds(td):
27 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6
29 class TimeFuncTestCase(unittest.TestCase):
31 @skipIfNotPythonVersion
32 def test_total_seconds(self):
33 date = datetime.timedelta(2, 468, 506260)
34 seconds1 = _get_total_seconds(date)
35 seconds2 = date.total_seconds()
37 self.assertEquals(seconds1, seconds2)
40 if __name__ == '__main__':