25 lines
641 B
Python
25 lines
641 B
Python
|
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
|