Remove CLS collection and support a full news AI reset
This commit is contained in:
1 parent
dd50cb7df8
commit
fcd1cfc344
15 files changed
+340
-146
No files matched your search
@@ -242,7 +242,7 @@ def test_news_updates_metadata_without_creating_content_revision(trading, monkey
|
||||
"content_text": "正文", "author": "原作者", "tags": ["旧标签"], "is_paywalled": False,
|
||||
"published_at": datetime(2026, 10, 20, tzinfo=UTC), "source_updated_at": None, "extra": {},
|
||||
}
|
||||
news = NewsItem(id=1, source_code="cls_telegraph", external_id="1", revision_no=1,
|
||||
news = NewsItem(id=1, source_code="wscn_live", external_id="1", revision_no=1,
|
||||
content_hash=pipelines.content_hash(original), **original)
|
||||
incoming = dict(original)
|
||||
if change != "unchanged":
|
||||
@@ -272,7 +272,7 @@ def test_news_updates_metadata_without_creating_content_revision(trading, monkey
|
||||
|
||||
async def check():
|
||||
for _ in range(2):
|
||||
await pipeline.process_item({**incoming, "source_code": "cls_telegraph", "external_id": "1", "raw_response_id": 10})
|
||||
await pipeline.process_item({**incoming, "source_code": "wscn_live", "external_id": "1", "raw_response_id": 10})
|
||||
assert {key: getattr(news, key) for key in pipelines.UPDATABLE_FIELDS} == incoming
|
||||
assert news.content_hash == pipelines.content_hash(incoming)
|
||||
assert news.revision_no == (2 if change == "content" else 1)
|
||||
@@ -280,7 +280,7 @@ def test_news_updates_metadata_without_creating_content_revision(trading, monkey
|
||||
if change == "content":
|
||||
assert len(revisions) == run.items_revised == 1
|
||||
assert revisions[0].revision_no == 2 and revisions[0].content_html == incoming["content_html"]
|
||||
assert events == [{"id": 1, "source_code": "cls_telegraph", "kind": "revised"}]
|
||||
assert events == [{"id": 1, "source_code": "wscn_live", "kind": "revised"}]
|
||||
else:
|
||||
assert not revisions and not events and run.items_revised == 0
|
||||
asyncio.run(check())
|
||||
@@ -115,10 +115,10 @@ def test_news_search_matches_topics_across_languages_and_keeps_literal_queries(t
|
||||
connection.execute(text("INSERT INTO news_items VALUES (:id, :source, :title, :body)"), [
|
||||
{"id": i, "source": source, "title": title, "body": body}
|
||||
for i, source, title, body in [
|
||||
(1, "cls_telegraph", "比特币消息", ""), (2, "coindesk", "Bitcoin market update", ""),
|
||||
(1, "wscn_live", "比特币消息", ""), (2, "coindesk", "Bitcoin market update", ""),
|
||||
(3, "coindesk", "Network update", "Ethereum update"),
|
||||
(4, "wscn_live", "美联储声明", ""), (5, "fed", "Federal Reserve statement", ""),
|
||||
(6, "bls", "Consumer Price Index", ""), (7, "cls_telegraph", "消费者价格指数公布", ""),
|
||||
(6, "bls", "Consumer Price Index", ""), (7, "wscn_live", "消费者价格指数公布", ""),
|
||||
(8, "bls", "Employment Situation", ""), (9, "bea", "Gross Domestic Product", ""),
|
||||
(10, "bea", "Personal Income and Outlays", "Personal consumption expenditures"),
|
||||
(11, "coindesk", "50%_profit", ""), (12, "coindesk", "50xxx_profit", ""),
|
||||
|
||||
Reference in new issue
Block a user