Fix official news discovery and calendar recovery
Development CI / check-and-build (push) Successful in 3m50s
GitHub Git mirror / mirror (push) Successful in 6s
Development CI / deploy-development (push) Successful in 2m31s

This commit is contained in:
eezd committed 2026-11-05 22:20:47 +08:00
1 parent e69b39a0de
commit 55585e36c1
9 files changed
+286 -7

No files matched your search

+19
View File
@@ -351,3 +351,22 @@ def test_cross_day_membership_does_not_withdraw_until_all_buckets_remove_it(trad
await save_entry(session, original, 4, now)
assert row.schedule_status == 'scheduled'
asyncio.run(run())
@pytest.mark.parametrize('country', [None, '', ' \t '])
def test_optional_empty_country_is_unlabelled_without_inference(country):
body = deepcopy(FIXTURE['event:2025-01-08'])
body['list'] = body['list'][:1]
body['list'][0]['country'] = country
entry, = normalize(body, 'event', date(2025, 1, 8))
assert entry.values['_jin10']['country_name'] == '未标注'
assert entry.values['_jin10']['country_code'] == 'UNKNOWN'
assert body['list'][0]['country'] == country
@pytest.mark.parametrize('country', [7, [], {}])
def test_optional_country_still_rejects_non_string_values(country):
body = deepcopy(FIXTURE['event:2025-01-08'])
body['list'][0]['country'] = country
with pytest.raises(ValueError, match='country'):
normalize(body, 'event', date(2025, 1, 8))