def test_header_happy(names, col_idx, feature_idx): h = Header(column_names=["a", "b", "c"], target_column_name="b") assert h.target_column_index == 1 assert h.as_feature_indices(names) == feature_idx assert h.as_column_indices(names) == col_idx assert h.num_features == 2 assert h.num_columns == 3
def test_header_error_as_feature_indices(names, error_regex): h = Header(column_names=["a", "b", "c"], target_column_name="b") assert h.target_column_index == 1 with pytest.raises(ValueError) as err: h.as_feature_indices(names) err.match(error_regex)