Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_validate_and_populate_min_responses_but_no_candidate():
data = {'experiment_id': 'experiment_1',
'train_file': 'data/rsmtool_smTrain.csv',
'test_file': 'data/rsmtool_smEval.csv',
'model': 'LinearRegression',
'min_responses_per_candidate': 5}
validate_and_populate_json_fields(data)
def test_process_fields_with_non_boolean():
data = {'experiment_id': 'experiment_1',
'train_file': 'data/rsmtool_smTrain.csv',
'test_file': 'data/rsmtool_smEval.csv',
'description': 'Test',
'model': 'empWt',
'use_scaled_predictions': 'True',
'feature_prefix': '1gram, 2gram',
'subgroups': 'native language, GPA_range',
'exclude_zero_scores': 'Yes'}
newdata = process_json_fields(validate_and_populate_json_fields(data))
def test_validate_and_populate_missing_fields():
data = {'expID': 'test'}
validate_and_populate_json_fields(data)
def test_validate_experiment_id_9():
data = {'summary_id': 'this_is_a_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_long_id',
'experiment_dirs': []}
validate_and_populate_json_fields(data, context='rsmsummarize')
def test_validate_experiment_id_7():
data = {'comparison_id': 'this_is_a_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_really_long_id',
'experiment_id_old': 'old_experiment',
'experiment_dir_old': 'data/old',
'experiment_id_new': 'new_experiment',
'experiment_dir_new': 'data/new',}
validate_and_populate_json_fields(data, context='rsmcompare')
def test_validate_experiment_id_4():
data = {'comparison_id': 'old vs new',
'experiment_id_old': 'old experiment',
'experiment_dir_old': 'data/old',
'experiment_id_new': 'new_experiment',
'experiment_dir_new': 'data/new',}
validate_and_populate_json_fields(data, context='rsmcompare')
def test_validate_and_populate_unspecified_fields():
data = {'experiment_id': 'experiment_1',
'train_file': 'data/rsmtool_smTrain.csv',
'test_file': 'data/rsmtool_smEval.csv',
'model': 'LinearRegression'}
newdata = validate_and_populate_json_fields(data)
assert_equal(newdata['id_column'], 'spkitemid')
assert_equal(newdata['use_scaled_predictions'], False)
assert_equal(newdata['select_transformations'], False)
assert_equal(newdata['general_sections'], 'all')
assert_equal(newdata['description'], '')
def test_validate_experiment_id_1():
data = {'experiment_id': 'test experiment',
'train_file': 'data/rsmtool_smTrain.csv',
'test_file': 'data/rsmtool_smEval.csv',
'model': 'LinearRegression'}
validate_and_populate_json_fields(data)
def test_validate_and_populate_unknown_fields():
data = {'experiment_id': 'experiment_1',
'train_file': 'data/rsmtool_smTrain.csv',
'test_file': 'data/rsmtool_smEval.csv',
'description': 'Test',
'model': 'LinearRegression',
'output': 'foobar'}
validate_and_populate_json_fields(data)
def test_validate_experiment_id_8():
data = {'summary_id': 'model summary',
'experiment_dirs': []}
validate_and_populate_json_fields(data, context='rsmsummarize')