Ejemplo n.º 1
0
def test_validate_seed_lines_too_many_fields(test_data):
    batches = DataFrameBatch(df=test_data, config=config_template, batch_size=3)

    with pytest.raises(RuntimeError) as err:
        _validate_batch_seed_values(
            batches.batches[0],
            {"ID_Code": "foo", "target": 0, "var_0": 33, "var_1": 33},
        )
    assert "number of seed fields" in str(err.value)
Ejemplo n.º 2
0
def test_validate_seed_lines_field_not_present(test_data):
    batches = DataFrameBatch(df=test_data, config=config_template, batch_size=3)

    with pytest.raises(RuntimeError) as err:
        _validate_batch_seed_values(
            batches.batches[0],
            {
                "ID_code": "foo",
                "target": 0,
                "var_1": 33,
            },
        )
    assert "The header: var_0 is not in the seed" in str(err.value)
Ejemplo n.º 3
0
def test_validate_seed_lines_ok_two_field(test_data):
    batches = DataFrameBatch(df=test_data, config=config_template, batch_size=3)

    check = _validate_batch_seed_values(
        batches.batches[0], {"ID_code": "foo", "target": 1}
    )
    assert check == "foo|1|"
Ejemplo n.º 4
0
def test_validate_seed_lines_ok_full_size(test_data):
    batches = DataFrameBatch(df=test_data, config=config_template, batch_size=3)

    check = _validate_batch_seed_values(
        batches.batches[0],
        {
            "ID_code": "foo",
            "target": 0,
            "var_0": 33,
        },
    )
    assert check == "foo|0|33|"