Merge dev: family canon, milestone 463 steps 1-6 #206
@@ -94,6 +94,14 @@ async def corpus():
|
|||||||
return ids
|
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):
|
async def _search(uid, **kw):
|
||||||
with patch("scribe.services.embeddings.get_embedding", AsyncMock(return_value=QUERY_VEC)):
|
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)
|
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"}
|
b_own.data = {"language": "dart"}
|
||||||
await s.commit()
|
await s.commit()
|
||||||
reach = await adoption_svc.family_reach_ids(corpus["b"])
|
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 def test_a_retired_idea_reaches_nobody(corpus):
|
||||||
async with async_session() as s:
|
async with async_session() as s:
|
||||||
(await s.get(FamilyIdea, corpus["idea"])).status = "retired"
|
(await s.get(FamilyIdea, corpus["idea"])).status = "retired"
|
||||||
await s.commit()
|
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 -------------------
|
# --- the entry readout and the owed answers a close hands back -------------------
|
||||||
|
|||||||
Reference in New Issue
Block a user