Skip to content

Commit

Permalink
Merge 755274d into 4004cd3
Browse files Browse the repository at this point in the history
  • Loading branch information
d-bohls committed Mar 27, 2018
2 parents 4004cd3 + 755274d commit c8b3780
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions nixnet/database/_dbc_signal_value_table.py
Expand Up @@ -43,7 +43,7 @@ def __iter__(self):
return self.keys()

def __getitem__(self, key):
# type: (typing.Text) -> typing.Text
# type: (typing.Text) -> int
"""Return the value.
Args:
Expand Down Expand Up @@ -82,7 +82,7 @@ def items(self):

@property
def _value_table(self):
# type: () -> typing.Dict[typing.Text, typing.Text]
# type: () -> typing.Dict[typing.Text, int]
mode = constants.GetDbcAttributeMode.VALUE_TABLE_LIST
attribute_size = _funcs.nxdb_get_dbc_attribute_size(self._handle, mode, '')
attribute_info = _funcs.nxdb_get_dbc_attribute(self._handle, mode, '', attribute_size)
Expand All @@ -97,6 +97,6 @@ def _value_table(self):
# table_string is of the format 'value1, key1, value2, key2, ...'
# convert to a dict: { 'key1': int('value1'), 'key2': int('value2'), ... }
table_dict = dict(
(key, value)
(key, int(value))
for value, key in zip(table_list[0::2], table_list[1::2]))
return table_dict
10 changes: 5 additions & 5 deletions tests/test_dbc_signal_value_table.py
Expand Up @@ -62,10 +62,10 @@ def test_signal_dbc_signal_value_table():

# test container
assert sorted(sig1.dbc_signal_value_table.keys()) == ['High', 'Low', 'Zero']
assert sorted(sig1.dbc_signal_value_table.values()) == ['-10', '0', '4']
assert sorted(sig1.dbc_signal_value_table.items()) == [('High', '4'), ('Low', '-10'), ('Zero', '0')]
assert sorted(sig1.dbc_signal_value_table.values()) == [-10, 0, 4]
assert sorted(sig1.dbc_signal_value_table.items()) == [('High', 4), ('Low', -10), ('Zero', 0)]

# test values
assert sig1.dbc_signal_value_table['Low'] == '-10'
assert sig1.dbc_signal_value_table['High'] == '4'
assert sig1.dbc_signal_value_table['Zero'] == '0'
assert sig1.dbc_signal_value_table['Low'] == -10
assert sig1.dbc_signal_value_table['High'] == 4
assert sig1.dbc_signal_value_table['Zero'] == 0

0 comments on commit c8b3780

Please sign in to comment.