Ejemplo n.º 1
0
def test_Object(eflr_data: DataForEFLR):
    eflr_data.rewind()
    template = EFLR.Template()
    template.read(eflr_data.template)
    obj = EFLR.Object(eflr_data.object, template)
    assert obj.name == RepCode.ObjectName(O=0, C=0, I=b'TIME')
    assert eflr_data.object.remain == 1  # Object byte terminates template
Ejemplo n.º 2
0
def test_Template_header_as_strings(ld):
    template = EFLR.Template()
    template.read(ld)
    expected = [
        'LONG-NAME', 'ELEMENT-LIMIT', 'REPRESENTATION-CODE', 'UNITS',
        'DIMENSION'
    ]
    assert template.header_as_strings(
        stringify.stringify_object_by_type) == expected
Ejemplo n.º 3
0
def test_Object_attr_label_map():
    OBJECT_DATA_FROM_STANDARD[0].rewind()
    template = EFLR.Template()
    template.read(OBJECT_DATA_FROM_STANDARD[0].template)
    obj = EFLR.Object(OBJECT_DATA_FROM_STANDARD[0].object, template)
    assert obj.attr_label_map == {
        b'LONG-NAME': 0,
        b'ELEMENT-LIMIT': 1,
        b'REPRESENTATION-CODE': 2,
        b'UNITS': 3,
        b'DIMENSION': 4,
    }
Ejemplo n.º 4
0
def test_Template(ld):
    template = EFLR.Template()
    template.read(ld)
    assert ld.remain == 1  # Object byte terminates template
    assert len(template.attrs) == 5
    expected = {
        b'LONG-NAME': 0,
        b'ELEMENT-LIMIT': 1,
        b'REPRESENTATION-CODE': 2,
        b'UNITS': 3,
        b'DIMENSION': 4,
    }
    assert template.attr_label_map == expected
Ejemplo n.º 5
0
def test_Object_getitem_label():
    OBJECT_DATA_FROM_STANDARD[0].rewind()
    template = EFLR.Template()
    template.read(OBJECT_DATA_FROM_STANDARD[0].template)
    obj = EFLR.Object(OBJECT_DATA_FROM_STANDARD[0].object, template)
    assert obj[b'LONG-NAME'].value == [ObjectName(O=0, C=0, I=b'1')]
Ejemplo n.º 6
0
def test_Template_eq(ld):
    template = EFLR.Template()
    template.read(ld)
    assert template == template
    assert template != 1