diff --git a/tests/test_integration_family_reach.py b/tests/test_integration_family_reach.py index b7f0416d..45e5e92e 100644 --- a/tests/test_integration_family_reach.py +++ b/tests/test_integration_family_reach.py @@ -94,6 +94,14 @@ async def corpus(): return ids +def _family(corpus) -> set[int]: + """This corpus's family records. The reach is computed across every + user's canon (the search applies readability afterwards), and the + integration database holds other tests' Android ideas, so assertions + about it are made on this corpus's ids only.""" + return {corpus["idea"], corpus["kotlin_ref"], corpus["python_ref"]} + + async def _search(uid, **kw): with patch("scribe.services.embeddings.get_embedding", AsyncMock(return_value=QUERY_VEC)): hits = await semantic_search_notes(uid, "how does the app update itself", limit=20, **kw) @@ -127,14 +135,14 @@ async def test_with_no_reference_in_the_projects_language_every_reference_comes( b_own.data = {"language": "dart"} await s.commit() reach = await adoption_svc.family_reach_ids(corpus["b"]) - assert reach == {corpus["idea"], corpus["kotlin_ref"], corpus["python_ref"]} + assert reach & _family(corpus) == _family(corpus) async def test_a_retired_idea_reaches_nobody(corpus): async with async_session() as s: (await s.get(FamilyIdea, corpus["idea"])).status = "retired" await s.commit() - assert await adoption_svc.family_reach_ids(corpus["b"]) == set() + assert not await adoption_svc.family_reach_ids(corpus["b"]) & _family(corpus) # --- the entry readout and the owed answers a close hands back -------------------