Files
MoFin/venv/lib/python3.12/site-packages/pandas/tests/tslibs/test_tzconversion.py
T
知微 fa45d8aa5f fix: 小果地址统一node122(兼容LAN+EasyTier)
- health_checklist.json: 192.168.1.122→node122
- ocr_client.py: docstring IP→node122
- docs/market-data-requirements.md: IP→node122
- 所有API调用通过ProxyHandler({})绕过系统代理
  Privoxy对node122:18003返回500,直连正常
2026-06-30 02:56:35 +08:00

27 lines
961 B
Python

import zoneinfo
import numpy as np
import pytest
from pandas._libs.tslibs.tzconversion import tz_localize_to_utc
class TestTZLocalizeToUTC:
def test_tz_localize_to_utc_ambiguous_infer(self):
# val is a timestamp that is ambiguous when localized to US/Eastern
val = 1_320_541_200_000_000_000
vals = np.array([val, val - 1, val], dtype=np.int64)
with pytest.raises(ValueError, match="2011-11-06 01:00:00"):
tz_localize_to_utc(vals, zoneinfo.ZoneInfo("US/Eastern"), ambiguous="infer")
with pytest.raises(ValueError, match="are no repeated times"):
tz_localize_to_utc(
vals[:1], zoneinfo.ZoneInfo("US/Eastern"), ambiguous="infer"
)
vals[1] += 1
msg = "There are 2 dst switches when there should only be 1"
with pytest.raises(ValueError, match=msg):
tz_localize_to_utc(vals, zoneinfo.ZoneInfo("US/Eastern"), ambiguous="infer")