Exemple #1
0
def test_input_spec_deps_list_ok(get_dependency_spec):
    """Expect no errors for a list of valid dependencies
    """
    data = get_dependency_spec
    n_errors_before = len(VALIDATION_ERRORS)
    validate_dependency_spec(data, 'energy_demand')
    assert len(VALIDATION_ERRORS) == n_errors_before
Exemple #2
0
def test_input_spec_deps_list_empty():
    """Expect no errors for an empty list
    """
    data = []
    # empty is ok
    n_errors_before = len(VALIDATION_ERRORS)
    validate_dependency_spec(data, 'energy_demand')
    assert len(VALIDATION_ERRORS) == n_errors_before
Exemple #3
0
def test_input_spec_deps_list():
    """Expect an error if input_spec dependencies is not a list
    """
    data = {1.618}
    validate_dependency_spec(data, 'energy_demand')
    ex = VALIDATION_ERRORS.pop()
    msg = "Expected a list of parameter definitions in 'energy_demand' model input " + \
          "specification, instead got {1.618}"
    assert msg in str(ex)
Exemple #4
0
def test_input_spec_type():
    """Expect an error if input_spec is not a dict
    """
    data = None
    validate_dependency_spec(data, 'energy_demand')
    ex = VALIDATION_ERRORS.pop()
    msg = "Expected a list of parameter definitions in 'energy_demand' model input " + \
          "specification, instead got None"
    assert msg in str(ex)