Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 8 additions & 9 deletions tests/unit/test_code_round_reads_backfill_statements.py
Original file line number Diff line number Diff line change
Expand Up @@ -227,20 +227,19 @@ async def statements(reuse_from: str) -> int:


def test_a_file_write_ends_the_no_file_row_answer() -> None:
async def go() -> tuple[_Repo, list[Any]]:
async def go() -> _Repo:
repo = _Repo()
reads = RoundReads(repo, ORG, NS)
await reads.prefetch(SOURCES, embedding_model=MODEL)
before = await reads.live_files_for_path(ORG, NS, "logo.png")
# The write comes before any read of the path: a read answered from the round
# takes the cached rows with it, and the write would have nothing to drop.
await reads.insert_rows("code_files", [{"path": "logo.png"}])
return repo, [before, await reads.live_files_for_path(ORG, NS, "logo.png")]
await reads.live_files_for_path(ORG, NS, "logo.png")
return repo

repo, (before, after) = asyncio.run(go())
assert before == [] and after == []
# answered from the round's read, then read after the buffered row was written
assert [c for c in repo.calls if c.startswith("live_files_for_path:")] == [
"live_files_for_path:logo.png"
]
repo = asyncio.run(go())
# read from the repository, after the buffered row was written
assert "live_files_for_path:logo.png" in repo.calls
assert repo.inserted == ["code_files"]


Expand Down
Loading