| 95 | cfg, |
| 96 | _summary_provider=provider, |
| 97 | ).build(LocalFilePath(path=_FIXTURE)) |
| 98 | |
| 99 | self.assertEqual(len(provider.calls), 1) |
| 100 | source_seen, chunk_set_seen, _ = provider.calls[0] |
| 101 | self.assertIs(source_seen, result.source_revision) |
| 102 | self.assertIs(chunk_set_seen, result.chunk_set) |
| 103 | self.assertEqual(len(result.source_revision.parsed.pages), 4) |
| 104 | self.assertTrue(result.chunk_set.chunks) |
| 105 | self.assertTrue(result.global_summary.summary) |
| 106 | self.assertGreaterEqual(len(result.global_summary.citations), 3) |
| 107 | self.assertGreaterEqual( |
| 108 | len( |
| 109 | { |
| 110 | citation.page_number |
| 111 | for citation in result.global_summary.citations |
| 112 | } |
| 113 | ), |
| 114 | 2, |
| 115 | ) |
| 116 | self.assertTrue( |
| 117 | all( |
| 118 | chunk.source_revision_id == result.source_revision.id |
| 119 | and chunk.source_spans |
| 120 | for chunk in result.chunk_set.chunks |
| 121 | ) |
| 122 | ) |
| 123 | |
| 124 | async def test_exact_arxiv_source_facts_are_code_owned(self) -> None: |
| 125 | raw = RawPaper( |
| 126 | bytes=_FIXTURE.read_bytes(), |
| 127 | content_type="application/pdf", |
| 128 | source_url="https://arxiv.org/pdf/1706.03762v7.pdf", |
| 129 | resolved_url="https://arxiv.org/pdf/1706.03762v7.pdf", |
| 130 | fetched_at=_WHEN, |
| 131 | arxiv_id="1706.03762v7", |
| 132 | title="Attention Is All You Need", |
| 133 | authors=("Ashish Vaswani",), |
| 134 | published_at=_WHEN, |
| 135 | updated_at=_WHEN, |
| 136 | ) |
| 137 | with patch( |
| 138 | "quantmind.flows.paper.fetch_arxiv", |
| 139 | new=AsyncMock(return_value=raw), |
| 140 | ): |
| 141 | result = await PaperFlow( |
| 142 | PaperSemanticCfg(chunk_size=256, chunk_overlap=32), |
| 143 | _summary_provider=_FakeSummaryProvider(), |
| 144 | ).build(ArxivIdentifier(id="1706.03762v7")) |
| 145 | |
| 146 | self.assertEqual(result.source_revision.arxiv_id, "1706.03762v7") |
| 147 | self.assertEqual(result.source_revision.source.kind, "arxiv") |
| 148 | self.assertEqual( |
| 149 | result.source_revision.title, "Attention Is All You Need" |
| 150 | ) |
| 151 | self.assertEqual( |
| 152 | result.source_revision.source.content_hash, |
| 153 | result.source_revision.parsed.source_hash, |
| 154 | ) |
nothing calls this directly
no outgoing calls
no test coverage detected