This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

at main 833 B View raw
1from app.profile import build_interests 2 3 4def test_interests_aggregate_topics_by_frequency(): 5 seeds = [ 6 {"topics": ["nix", "cli"]}, 7 {"topics": ["nix", "atproto"]}, 8 {"topics": ["nix"]}, 9 {"topics": None}, # tolerate missing topics 10 {"topics": ["CLI Tools"]}, # slug normalizes 11 ] 12 interests = build_interests(seeds, max_interests=5) 13 labels = [i["label"] for i in interests] 14 slugs = [i["slug"] for i in interests] 15 assert labels[0] == "nix" # most frequent first 16 assert "cli-tools" in slugs # multi-word topic is slugified 17 assert len(interests) <= 5 18 assert all(set(i.keys()) == {"label", "slug"} for i in interests) 19 20 21def test_interests_empty_when_no_topics(): 22 assert build_interests([{"topics": None}, {}], max_interests=5) == []