Example #1
0
def test_fdata_repcodes_fixed_size(tmpdir, merge_lis_prs):
    fpath = os.path.join(str(tmpdir), 'fdata-repcodes-fixed.lis')

    content = headers + [
        'data/lis/records/curves/dfsr-repcodes-fixed.lis.part',
        'data/lis/records/curves/fdata-repcodes-fixed.lis.part',
    ] + trailers

    merge_lis_prs(fpath, content)

    with lis.load(fpath) as (f, ):
        dfs = f.data_format_specs()[0]

        fmt = core.dfs_formatstring(dfs)
        assert fmt == 'bsilefrp'

        curves = lis.curves(f, dfs)
        assert curves['BYTE'] == [89]
        assert curves['I8  '] == [-128]
        assert curves['I16 '] == [153]
        assert curves['I32 '] == [-153]
        assert curves['F16 '] == [1.0]
        assert curves['F32 '] == [-1.0]
        assert curves['F32L'] == [-0.25]
        assert curves['F32F'] == [153.25]
Example #2
0
def test_dfsr_fmtstring():
    path = 'data/lis/MUD_LOG_1.LIS'

    with lis.load(path) as (_, lf, _):
        dfsr = lf.dfsr()[0]

        fmt = core.dfs_formatstring(dfsr)
        assert fmt == 'D' * 44
Example #3
0
def test_dfsr_fmtstring():
    path = 'data/lis/MUD_LOG_1.LIS'

    with lis.load(path) as (lf, *tail):
        dfsr = lf.data_format_specs()[0]

        fmt = core.dfs_formatstring(dfsr)
        assert fmt == 'f' * 44
Example #4
0
def test_fdata_repcodes_string(tmpdir, merge_lis_prs):
    fpath = os.path.join(str(tmpdir), 'fdata-repcodes-string.lis')

    content = headers + [
        'data/lis/records/curves/dfsr-repcodes-string.lis.part',
        'data/lis/records/curves/fdata-repcodes-string.lis.part',
    ] + trailers

    merge_lis_prs(fpath, content)

    with lis.load(fpath) as (f, ):
        dfs = f.data_format_specs()[0]

        fmt = core.dfs_formatstring(dfs)
        assert fmt == 'a32'

        curves = lis.curves(f, dfs)
        assert curves['STR '] == "Now this is a string of size 32 "
Example #5
0
def test_fdata_repcodes_mask(tmpdir, merge_lis_prs):
    fpath = os.path.join(str(tmpdir), 'fdata-repcodes-mask.lis')

    content = headers + [
        'data/lis/records/curves/dfsr-repcodes-mask.lis.part',
        'data/lis/records/curves/fdata-repcodes-mask.lis.part',
    ] + trailers

    merge_lis_prs(fpath, content)

    with lis.load(fpath) as (f, ):
        dfs = f.data_format_specs()[0]

        with pytest.raises(NotImplementedError):
            fmt = core.dfs_formatstring(dfs)
            assert fmt == 'm'

        with pytest.raises(NotImplementedError):
            curves = lis.curves(f, dfs)
            assert curves['MASK'] == bytearray([0xFF, 0xFF, 0xFF, 0xFF])