def __init__(self, component_descriptor: ComponentDescriptor, ld: LogicalData, template_attribute: TemplateAttribute, ): super().__init__(component_descriptor) if self.component_descriptor.has_attribute_L: self.label = RepCode.IDENT(ld) else: self.label = template_attribute.label if self.component_descriptor.has_attribute_C: self.count = RepCode.UVARI(ld) else: self.count = template_attribute.count if self.component_descriptor.has_attribute_R: self.rep_code = RepCode.USHORT(ld) else: self.rep_code = template_attribute.rep_code if self.component_descriptor.has_attribute_U: self.units = RepCode.UNITS(ld) else: self.units = template_attribute.units if self.component_descriptor.has_attribute_V: self.value = [RepCode.code_read(self.rep_code, ld) for _i in range(self.count)] else: self.value = template_attribute.value
def test_USHORT(ld, expected): result = RepCode.USHORT(ld) assert result == expected assert ld.remain == 0