예제 #1
0
def test_preprocess_nested_no_fields():
    spec = {
        "geo": {
            "type": "nested",
            "config": {"as_list": "true"},
            "refs": {"lat": 55.5, "long": 99.9}  # <- invalid should be fields
        }
    }
    with pytest.raises(SpecException):
        loader.preprocess_spec(spec)
예제 #2
0
def test_count_param_valid():
    spec = {'foo?count=2': ['A', 'B', 'C', 'D']}
    updated = preprocess_spec(spec)
    supplier = suppliers.values(updated['foo'])
    first = supplier.next(0)
    assert type(first) == list
    assert ['A', 'B'] == first
예제 #3
0
def test_preprocess_csv_select_missing_config(input_spec):
    with pytest.raises(SpecException):
        loader.preprocess_spec(input_spec)
예제 #4
0
def test_preprocess_csv_select(input_spec, expected_output_spec):
    # need first layer of pre-processing done
    updated = loader.preprocess_spec(input_spec)
    assert updated == expected_output_spec
예제 #5
0
def _test_invalid_spec(spec, key):
    updated = preprocess_spec(spec)
    with pytest.raises(SpecException):
        suppliers.values(updated[key])
예제 #6
0
def test_count_param_invalid():
    # the word two is not a valid count
    spec = {'foo?count=two': ['A', 'B', 'C', 'D']}
    updated = preprocess_spec(spec)
    with pytest.raises(ValueError):
        suppliers.values(updated['foo'])