diff --git a/services/recommender/tests/test_db_integration.py b/services/recommender/tests/test_db_integration.py index f72ad63..ff9bda6 100644 --- a/services/recommender/tests/test_db_integration.py +++ b/services/recommender/tests/test_db_integration.py @@ -186,7 +186,10 @@ def test_impression_features_roundtrip(world: dict[str, Any]) -> None: def test_demographic_prior_advances_age_and_preserves_own_feedback(world: dict[str, Any]) -> None: user = uid() with psycopg.connect(DSN, autocommit=True) as conn: - conn.execute("INSERT INTO users (id, username, password_hash) VALUES (%s, %s, 'x')", (user, f"cohort-{user[:6]}")) + conn.execute( + "INSERT INTO users (id, username, password_hash) VALUES (%s, %s, 'x')", + (user, f"cohort-{user[:6]}"), + ) # Target selected 13–19 twenty years ago; matching listeners are now 30–39. conn.execute( "INSERT INTO user_profiles_rec (user_id, onboarding) VALUES (%s, " @@ -204,7 +207,13 @@ def test_demographic_prior_advances_age_and_preserves_own_feedback(world: dict[s track = world["tracks"][0] # two matching listeners liked it assert 0 < profile.scores[track] <= 0.25 assert not profile.played - conn.execute("INSERT INTO track_reactions (user_id, track_id, reaction) VALUES (%s, %s, 'dislike')", (user, track)) + conn.execute( + "INSERT INTO track_reactions (user_id, track_id, reaction) VALUES (%s, %s, 'dislike')", + (user, track), + ) assert track not in load_profile(conn, user).scores - conn.execute("UPDATE user_profiles_rec SET onboarding = %s WHERE user_id = %s", (json.dumps({"gender": "female"}), user)) + conn.execute( + "UPDATE user_profiles_rec SET onboarding = %s WHERE user_id = %s", + (json.dumps({"gender": "female"}), user), + ) assert not load_profile(conn, user).scores, "no invented preferences when the cohort has no evidence"