def dev__get_header_string():
    testing_set = get_testing_set()

    print(os.path.isfile(testing_set['config_fn']), testing_set['config_fn'])

    o = PyposmatBadParametersFile(filename=testing_set['badparameters_out_fn'],
                                  config_fn=testing_set['config_fn'])
    print(o.get_header_string())
def dev__get_header_string():
    parameter_names = ['a', 'b', 'c']
    filename = 'test.out'

    f = PyposmatBadParametersFile()
    s = f.get_header_string(parameter_names=parameter_names)

    header_line_1 = ['sim_id'] + parameter_names + ['reason']
    header_line_2 = ['sim_id'] + len(parameter_names) * ['param'] + ['reason']
    s_test = "{}\n".format(",".join(header_line_1))
    s_test += "{}\n".format(",".join(header_line_2))
    print(s_test)
    print(s)
    print(s_test == s)
def test__get_header_string():
    f = PyposmatBadParametersFile()
    parameter_names = ['a', 'b', 'c']
    filename = 'test.out'

    f = PyposmatBadParametersFile()
    s = f.get_header_string(parameter_names=parameter_names)

    assert type(s) is str

    header_line_1 = ['sim_id'] + parameter_names + ['reason']
    header_line_2 = ['sim_id'] + len(parameter_names) * ['param'] + ['reason']
    s_test = "{}\n".format(",".join(header_line_1))
    s_test += "{}\n".format(",".join(header_line_2))

    assert s_test == s
def test__get_header_string():
    testing_set = get_testing_set()

    o_config = PyposmatConfigurationFile()
    o_config.read(filename=testing_set['config_fn'])
    assert os.path.isfile(testing_set['config_fn'])

    f = PyposmatBadParametersFile(filename=testing_set['badparameters_out_fn'],
                                  config_fn=testing_set['config_fn'])
    s = f.get_header_string()

    assert type(s) is str

    header_line_1 = ['sim_id'] \
            + o_config.parameter_names \
            + ['reason']
    header_line_2 = ['sim_id'] \
            + len(o_config.parameter_names)*['param'] \
            + ['reason']
    s_test = "{}\n".format(",".join(header_line_1))
    s_test += "{}\n".format(",".join(header_line_2))

    assert s_test == s