Inzynierka/Lib/site-packages/pandas/tests/tslibs/test_resolution.py

25 lines
641 B
Python
Raw Permalink Normal View History

2023-06-02 12:51:02 +02:00
import numpy as np
import pytz
from pandas._libs.tslibs import (
Resolution,
get_resolution,
)
from pandas._libs.tslibs.dtypes import NpyDatetimeUnit
def test_get_resolution_nano():
# don't return the fallback RESO_DAY
arr = np.array([1], dtype=np.int64)
res = get_resolution(arr)
assert res == Resolution.RESO_NS
def test_get_resolution_non_nano_data():
arr = np.array([1], dtype=np.int64)
res = get_resolution(arr, None, NpyDatetimeUnit.NPY_FR_us.value)
assert res == Resolution.RESO_US
res = get_resolution(arr, pytz.UTC, NpyDatetimeUnit.NPY_FR_us.value)
assert res == Resolution.RESO_US