Total Complexity | 2 |
Total Lines | 26 |
Duplicated Lines | 0 % |
Changes | 0 |
1 | # -*- coding: utf-8 -*- |
||
|
|||
2 | |||
3 | try: |
||
4 | import unittest |
||
5 | import logging |
||
6 | import sys |
||
7 | import time |
||
8 | from osm_poi_matchmaker.utils.timing import Timing |
||
9 | except ImportError as err: |
||
10 | logging.error('Error %s import module: %s', __name__, err) |
||
11 | logging.exception('Exception occurred') |
||
12 | |||
13 | sys.exit(128) |
||
14 | |||
15 | |||
16 | class TestTiming(unittest.TestCase): |
||
17 | def setUp(self): |
||
18 | self.one_sec = '0:00:00.10' |
||
19 | self.one_sec_timer = 0.1 |
||
20 | |||
21 | def test_timing(self): |
||
22 | timer = Timing() |
||
23 | time.sleep(self.one_sec_timer) |
||
24 | end = timer.end() |
||
25 | self.assertRegexpMatches(end, '{}.*'.format(self.one_sec), 10) |
||
26 |