You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
641 B
25 lines
641 B
1 year ago
|
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
|