def test_direct_with_multiple_possible_paths(games_es):
    error_text = "There are multiple relationships to the base dataframe. " \
                 "You must specify a relationship."
    with pytest.raises(RuntimeError, match=error_text):
        DirectFeature(IdentityFeature(games_es['teams'].ww['name']), 'games')

    # Does not raise if path specified.
    relationship = next(r for r in games_es.get_forward_relationships('games')
                        if r._child_column_name == 'home_team_id')
    feat = DirectFeature(IdentityFeature(games_es['teams'].ww['name']),
                         'games',
                         relationship=relationship)
    assert feat.relationship_path_name() == 'teams[home_team_id]'
    assert feat.get_name() == 'teams[home_team_id].name'
Example #2
0
def test_direct_with_multiple_possible_paths(games_es):
    error_text = ("There are multiple relationships to the base dataframe. "
                  "You must specify a relationship.")
    with pytest.raises(RuntimeError, match=error_text):
        DirectFeature(IdentityFeature(games_es["teams"].ww["name"]), "games")

    # Does not raise if path specified.
    relationship = next(r for r in games_es.get_forward_relationships("games")
                        if r._child_column_name == "home_team_id")
    feat = DirectFeature(
        IdentityFeature(games_es["teams"].ww["name"]),
        "games",
        relationship=relationship,
    )
    assert feat.relationship_path_name() == "teams[home_team_id]"
    assert feat.get_name() == "teams[home_team_id].name"
def test_direct_with_single_possible_path(es):
    feat = DirectFeature(IdentityFeature(es['customers'].ww['age']),
                         'sessions')
    assert feat.relationship_path_name() == 'customers'
    assert feat.get_name() == 'customers.age'
Example #4
0
def test_direct_with_single_possible_path(es):
    feat = DirectFeature(IdentityFeature(es["customers"].ww["age"]),
                         "sessions")
    assert feat.relationship_path_name() == "customers"
    assert feat.get_name() == "customers.age"