TestDictModes.test_getitem()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
c 1
b 0
f 0
dl 0
loc 8
rs 9.4285
cc 1
1
import unittest
2
import sys
3
4
if sys.version_info[0] < 3:
5
    import mock
6
else:
7
    import unittest.mock as mock
8
import obdlib.obd.modes as modes
9
10
11
class TestDictModes(unittest.TestCase):
12
    @mock.patch('obdlib.obd.modes.DictModes.pids')
13
    def test_getitem(self, mock_pids):
14
        d = {
15
            1: 'a'
16
        }
17
        response = modes.DictModes(d)
18
        response = response[1]
19
        self.assertEqual(response, 'a')
20
21
22
suite = unittest.TestLoader().loadTestsFromTestCase(TestDictModes)
23
unittest.TextTestRunner(verbosity=2).run(suite)
24