コード例 #1
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_tags_missing_tags():
    config, tags = init('f')
    find = 'hdf_structure'
    replace = 'hdf_tags'
    mod.replace_text_in_file(config, find, replace)
    hdf.verify(config, data_file)
    time.sleep(1)
    assert res.is_text_in_file(logfile, '/exchange/missing')
    assert res.is_text_in_file(logfile, '/exchange/missing1')
    clean()
コード例 #2
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_struct_missing_tags_attrib():
    config, tags = init('h')
    hdf.verify(config, data_file)
    time.sleep(1)
    assert res.is_text_in_file(logfile, '/exchange/missing')
    assert res.is_text_in_file(logfile, '/exchange/missing1')
    assert res.is_text_in_file(logfile, 'should be axes:theta_dark:y:x')
    assert res.is_text_in_file(logfile, 'should be axes:theta_white:y:x')
    assert res.is_text_in_file(logfile, 'attributes are missing in tag /exchange/theta')
    clean()
コード例 #3
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_tags_missing_tags():
    config, tags = init('f')
    find = 'hdf_structure'
    replace = 'hdf_tags'
    mod.replace_text_in_file(config, find, replace)
    hdf.verify(config, data_file)
    time.sleep(1)
    assert res.is_text_in_file(logfile, '/exchange/missing')
    assert res.is_text_in_file(logfile, '/exchange/missing1')
    clean()
コード例 #4
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_struct_missing_tags_attrib():
    config, tags = init('h')
    hdf.verify(config, data_file)
    time.sleep(1)
    assert res.is_text_in_file(logfile, '/exchange/missing')
    assert res.is_text_in_file(logfile, '/exchange/missing1')
    assert res.is_text_in_file(logfile, 'should be axes:theta_dark:y:x')
    assert res.is_text_in_file(logfile, 'should be axes:theta_white:y:x')
    assert res.is_text_in_file(
        logfile, 'attributes are missing in tag /exchange/theta')
    clean()
コード例 #5
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_bad_file():
    config, tags = init('e')
    data_file = "data/test_datax.h5"
    # the file.verify will exit with -1
    try:
        hdf.verify(config, data_file)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'parameter error: file data/test_datax.h5 does not exist')
    clean()
コード例 #6
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_bad_file():
    config, tags = init('e')
    data_file = "data/test_datax.h5"
    # the file.verify will exit with -1
    try:
        hdf.verify(config, data_file)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(
        logfile, 'parameter error: file data/test_datax.h5 does not exist')
    clean()
コード例 #7
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_conf_error_no_schema():
    config, tags = init('a')
    find = 'schema'
    replace = 'schemax'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'configuration error: schema is not configured')
    clean()
コード例 #8
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_no_schema():
    config, tags = init('b')
    find = 'tags'
    replace = 'tagsx'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'configuration error: file test/schemas/tagsxb.json does not exist')
    clean()
コード例 #9
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_bad_type():
    config, tags = init('d')
    find = 'hdf_structure'
    replace = 'hdf_structurex'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'configured verification type hdf_structurex is not supported')
    clean()
コード例 #10
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_conf_error_no_type():
    config, tags = init('c')
    find = 'verification_type'
    replace = 'verification_typex'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'config error: verification type not configured')
    clean()
コード例 #11
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_conf_error_no_type():
    config, tags = init('c')
    find = 'verification_type'
    replace = 'verification_typex'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(
        logfile, 'config error: verification type not configured')
    clean()
コード例 #12
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_conf_error_no_schema():
    config, tags = init('a')
    find = 'schema'
    replace = 'schemax'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(
        logfile, 'configuration error: schema is not configured')
    clean()
コード例 #13
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_bad_type():
    config, tags = init('d')
    find = 'hdf_structure'
    replace = 'hdf_structurex'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(
        logfile,
        'configured verification type hdf_structurex is not supported')
    clean()
コード例 #14
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_no_schema():
    config, tags = init('b')
    find = 'tags'
    replace = 'tagsx'
    mod.replace_text_in_file(config, find, replace)
    # the file.verify will exit with -1
    try:
        hdf.verify(config, None)
    except:
        pass
    time.sleep(1)
    assert res.is_text_in_file(
        logfile,
        'configuration error: file test/schemas/tagsxb.json does not exist')
    clean()
コード例 #15
0
def hdf(conf, fname):
    """
    HDF file structure verifier.

    Parameters
    ----------
    conf : str
        configuration file name, including path

    file : str
        File Name to verify including path

    Returns
    -------
    boolean


    """

    if dqhdf.verify(conf, fname):
        print('All tags exist and meet conditions')
    else:
        print(
            'Some of the tags do not exist or do not meet conditions, check log file'
        )
コード例 #16
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_tags_no_missing_tags():
    config, tags = init('g')
    find = 'hdf_structure'
    replace = 'hdf_tags'
    mod.replace_text_in_file(config, find, replace)
    match = 'missing'
    mod.delete_line_in_file(tags, match)
    time.sleep(1)
    assert (hdf.verify(config, data_file))
    assert res.is_text_in_file(logfile, 'All required tags exist')
    clean()
コード例 #17
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_tags_no_missing_tags():
    config, tags = init('g')
    find = 'hdf_structure'
    replace = 'hdf_tags'
    mod.replace_text_in_file(config, find, replace)
    match = 'missing'
    mod.delete_line_in_file(tags, match)
    time.sleep(1)
    assert (hdf.verify(config, data_file))
    assert res.is_text_in_file(logfile, 'All required tags exist')
    clean()
コード例 #18
0
ファイル: test_hdf.py プロジェクト: bfrosik/data-quality
def test_struct_no_missing():
    config, tags = init('i')
    match = 'missing'
    mod.delete_line_in_file(tags, match)
    match = 'axes'
    mod.delete_line_in_file(tags, match)
    match = 'degrees'
    mod.delete_line_in_file(tags, match)
    assert (hdf.verify(config, data_file))
    time.sleep(1)
    assert res.is_text_in_file(logfile, 'All required tags exist and meet conditions')
    clean
コード例 #19
0
ファイル: test_hdf.py プロジェクト: decarlof/data-quality
def test_struct_no_missing():
    config, tags = init('i')
    match = 'missing'
    mod.delete_line_in_file(tags, match)
    match = 'axes'
    mod.delete_line_in_file(tags, match)
    match = 'degrees'
    mod.delete_line_in_file(tags, match)
    assert (hdf.verify(config, data_file))
    time.sleep(1)
    assert res.is_text_in_file(logfile,
                               'All required tags exist and meet conditions')
    clean
コード例 #20
0
ファイル: check.py プロジェクト: bfrosik/data-quality
def hdf(conf, fname):
    """
    HDF file structure verifier.

    Parameters
    ----------
    conf : str
        configuration file name, including path

    file : str
        File Name to verify including path

    Returns
    -------
    boolean


    """

    if dqhdf.verify(conf, fname):
        print("All tags exist and meet conditions")
    else:
        print("Some of the tags do not exist or do not meet conditions, check log file")