403Webshell
Server IP : 209.209.40.120  /  Your IP : 216.73.217.112
Web Server : Microsoft-IIS/10.0
System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586
User : NEWWWW$ ( 0)
PHP Version : 8.3.30
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  C:/Python312/Lib/site-packages/pandas/tests/tslibs/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : C:/Python312/Lib/site-packages/pandas/tests/tslibs//test_tzconversion.py
import numpy as np
import pytest
import pytz

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(pytz.AmbiguousTimeError, match="2011-11-06 01:00:00"):
            tz_localize_to_utc(vals, pytz.timezone("US/Eastern"), ambiguous="infer")

        with pytest.raises(pytz.AmbiguousTimeError, match="are no repeated times"):
            tz_localize_to_utc(vals[:1], pytz.timezone("US/Eastern"), ambiguous="infer")

        vals[1] += 1
        msg = "There are 2 dst switches when there should only be 1"
        with pytest.raises(pytz.AmbiguousTimeError, match=msg):
            tz_localize_to_utc(vals, pytz.timezone("US/Eastern"), ambiguous="infer")

Youez - 2016 - github.com/yon3zu
LinuXploit