예제 #1
0
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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")