test.test_opening_hours   A
last analyzed

Complexity

Total Complexity 5

Size/Duplication

Total Lines 33
Duplicated Lines 0 %

Importance

Changes 0
Metric Value
eloc 27
dl 0
loc 33
rs 10
c 0
b 0
f 0
wmc 5

2 Methods

Rating   Name   Duplication   Size   Complexity  
A TestOpeningHours.test_extract_opening_hours() 0 13 4
A TestOpeningHours.setUp() 0 2 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
    from osm_poi_matchmaker.libs.opening_hours import OpeningHours
8
    from test.test_opening_hours_data import OPENING_HOURS_TEST_DATA
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 TestOpeningHours(unittest.TestCase):
0 ignored issues
show
introduced by
Missing class docstring
Loading history...
17
    def setUp(self):
18
        self.opening_hours = OPENING_HOURS_TEST_DATA
19
20
    def test_extract_opening_hours(self):
0 ignored issues
show
introduced by
Missing function or method docstring
Loading history...
21
        for i in self.opening_hours:
22
            if 'public_holiday_open' not in i:
23
                i['public_holiday_open'] = None
24
            p = OpeningHours(i['nonstop'], i['mo_o'], i['tu_o'], i['we_o'], i['th_o'], i['fr_o'], i['sa_o'],
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (108/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
Coding Style Naming introduced by
Variable name "p" doesn't conform to snake_case naming style ('([^\\W\\dA-Z][^\\WA-Z]2,|_[^\\WA-Z]*|__[^\\WA-Z\\d_][^\\WA-Z]+__)$' pattern)

This check looks for invalid names for a range of different identifiers.

You can set regular expressions to which the identifiers must conform if the defaults do not match your requirements.

If your project includes a Pylint configuration file, the settings contained in that file take precedence.

To find out more about Pylint, please refer to their site.

Loading history...
25
                             i['su_o'], i['mo_c'], i['tu_c'], i['we_c'], i['th_c'], i['fr_c'], i['sa_c'],
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (105/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
26
                             i['su_c'], i['summer_mo_o'], i['summer_tu_o'], i['summer_we_o'], i['summer_th_o'],
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
27
                             i['summer_fr_o'], i['summer_sa_o'], i['summer_su_o'], i['summer_mo_c'],
28
                             i['summer_tu_c'], i['summer_we_c'], i['summer_th_c'], i['summer_fr_c'],
29
                             i['summer_sa_c'], i['summer_su_c'], i['lunch_break_start'], i['lunch_break_stop'],
0 ignored issues
show
Coding Style introduced by
This line is too long as per the coding-style (111/100).

This check looks for lines that are too long. You can specify the maximum line length.

Loading history...
30
                             i['public_holiday_open'])
31
            with self.subTest():
32
                self.assertEqual(i['processed'], p.process())
33