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 version 2 as
8 # published by the Free Software Foundation;
10 # This program is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details.
15 # You should have received a copy of the GNU General Public License
16 # along with this program. If not, see <http://www.gnu.org/licenses/>.
18 # Author: Lucia Guevgeozian <lucia.guevgeozian_odizzio@inria.fr>
20 from test_utils import skipIfNotPythonVersion
25 def _get_total_seconds(td):
26 return (td.microseconds + (td.seconds + td.days * 24 * 3600) * 1e6) / 1e6
28 class TimeFuncTestCase(unittest.TestCase):
30 @skipIfNotPythonVersion
31 def test_total_seconds(self):
32 date = datetime.timedelta(2, 468, 506260)
33 seconds1 = _get_total_seconds(date)
34 seconds2 = date.total_seconds()
36 self.assertEqual(seconds1, seconds2)
39 if __name__ == '__main__':