test.test_timing.TestTiming.test_timing()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 5
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 5
nop 1
dl 0
loc 5
rs 10
c 0
b 0
f 0
1
# -*- coding: utf-8 -*-
0 ignored issues
show
introduced by
Missing module docstring
Loading history...
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):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
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):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
22
        timer = Timing()
23
        time.sleep(self.one_sec_timer)
24
        end = timer.end()
25
        self.assertRegexpMatches(end, '{}.*'.format(self.one_sec), 10)
0 ignored issues
show
introduced by
Using deprecated method assertRegexpMatches()
Loading history...
26