Skip to content

Commit 9dbbe04

Browse files
author
ZhongJiaqi
committed
fix: 时区无关的 fixture timestamps(修 CI UTC 失败)
CI 在 UTC 跑,本地在 CST,原 fixture 用 1 月 1 日的 timestamp (1514736000 等)在两个时区解析出不同的年份,导致: - test_contains_year_trend_bars 期 2026 但 CI 显示 2025 - test_non_numeric_readtime_key_ignored 期 2025 但 CI 显示 2024 - test_breakout_year "爆发之年" 不触发 改用各年 7 月 1 日的 timestamp,远离年边界,任何时区都稳。 registTime 保持不变(2018-03-08 两个时区都是 2018)。
1 parent a2563b3 commit 9dbbe04

2 files changed

Lines changed: 10 additions & 10 deletions

File tree

tests/fixtures/readdata_overall.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,15 @@
99
"totalReadTime": 717244,
1010
"registTime": 1520470365,
1111
"readTimes": {
12-
"1514736000": 0,
13-
"1546272000": 0,
14-
"1577808000": 0,
15-
"1609430400": 29520,
16-
"1640966400": 4320,
17-
"1672502400": 7200,
18-
"1704038400": 5400,
19-
"1735660800": 189000,
20-
"1767196800": 481680
12+
"1530403200": 0,
13+
"1561939200": 0,
14+
"1593561600": 0,
15+
"1625097600": 29520,
16+
"1656633600": 4320,
17+
"1688169600": 7200,
18+
"1719792000": 5400,
19+
"1751328000": 189000,
20+
"1782950400": 481680
2121
},
2222
"readLongest": [
2323
{"book": {"title": "影响力(全新升级版)"}, "readTime": 163080, "tags": ["笔记最多"]},

tests/test_callouts.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ def test_empty_data_does_not_crash(self):
6161

6262
def test_non_numeric_readtime_key_ignored(self):
6363
# readTimes 含非数字 key 时跳过该项,不崩
64-
bad = {"readTimes": {"1735660800": 100, "bad_key": 50}}
64+
bad = {"readTimes": {"1751328000": 100, "bad_key": 50}}
6565
md = weread.build_quantity_callout(bad)
6666
self.assertIn("2025", md)
6767
self.assertNotIn("bad_key", md)

0 commit comments

Comments
 (0)