1
0
mirror of https://github.com/no2chem/wideq.git synced 2025-05-18 08:10:17 -07:00

Removed length for BitValue namedtuples.

This commit is contained in:
Aaron Godfrey 2019-06-30 22:32:48 -07:00
parent 556943cbfb
commit 82dbf607c1
2 changed files with 7 additions and 12 deletions

View File

@ -90,12 +90,12 @@ class ModelInfoTest(unittest.TestCase):
def test_value_bit(self): def test_value_bit(self):
actual = self.model_info.value('Option1') actual = self.model_info.value('Option1')
expected = BitValue({ expected = BitValue({
0: {'length': 1, 'value': 'ChildLock'}, 0: 'ChildLock',
1: {'length': 1, 'value': 'ReduceStatic'}, 1: 'ReduceStatic',
2: {'length': 1, 'value': 'EasyIron'}, 2: 'EasyIron',
3: {'length': 1, 'value': 'DampDrySingal'}, 3: 'DampDrySingal',
4: {'length': 1, 'value': 'WrinkleCare'}, 4: 'WrinkleCare',
7: {'length': 1, 'value': 'AntiBacterial'}, 7: 'AntiBacterial',
}) })
self.assertEqual(expected, actual) self.assertEqual(expected, actual)

View File

@ -323,12 +323,7 @@ class ModelInfo(object):
d['option'].get('step', 1) d['option'].get('step', 1)
) )
elif d['type'].lower() == 'bit': elif d['type'].lower() == 'bit':
bit_values = { bit_values = {opt['startbit']: opt['value'] for opt in d['option']}
opt['startbit']: {
'length': opt['length'],
'value': opt['value'],
} for opt in d['option']
}
return BitValue(bit_values) return BitValue(bit_values)
elif d['type'].lower() == 'reference': elif d['type'].lower() == 'reference':
return ReferenceValue(d['option'][0]) return ReferenceValue(d['option'][0])