test.test_timing   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 26
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 20
dl 0
loc 26
rs 10
c 0
b 0
f 0
wmc 2

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestTiming.setUp() 0 3 1
A TestTiming.test_timing() 0 5 1
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