2
2
from functools import partial
3
3
from io import StringIO
4
4
5
+ from dateutil .tz import tzlocal
5
6
import numpy as np
6
7
import pytest
7
8
import pytz
@@ -480,6 +481,11 @@ def test_upsample_with_limit():
480
481
@pytest .mark .parametrize ("rule" , ["Y" , "3M" , "15D" , "30H" , "15Min" , "30S" ])
481
482
def test_nearest_upsample_with_limit (tz_aware_fixture , freq , rule ):
482
483
# GH 33939
484
+ tz = tz_aware_fixture
485
+ if str (tz ) == "tzlocal()" and rule == "30S" and freq in ["Y" , "10M" ]:
486
+ # GH#34413 separate these so we can mark as slow, see
487
+ # test_nearest_upsample_with_limit_tzlocal
488
+ return
483
489
rng = date_range ("1/1/2000" , periods = 3 , freq = freq , tz = tz_aware_fixture )
484
490
ts = Series (np .random .randn (len (rng )), rng )
485
491
@@ -488,6 +494,20 @@ def test_nearest_upsample_with_limit(tz_aware_fixture, freq, rule):
488
494
tm .assert_series_equal (result , expected )
489
495
490
496
497
+ @pytest .mark .slow
498
+ @pytest .mark .parametrize ("freq" , ["Y" , "10M" ])
499
+ def test_nearest_upsample_with_limit_tzlocal (freq ):
500
+ # GH#33939, GH#34413 split off from test_nearest_upsample_with_limit
501
+ rule = "30S"
502
+ tz = tzlocal ()
503
+ rng = date_range ("1/1/2000" , periods = 3 , freq = freq , tz = tz )
504
+ ts = Series (np .random .randn (len (rng )), rng )
505
+
506
+ result = ts .resample (rule ).nearest (limit = 2 )
507
+ expected = ts .reindex (result .index , method = "nearest" , limit = 2 )
508
+ tm .assert_series_equal (result , expected )
509
+
510
+
491
511
def test_resample_ohlc (series ):
492
512
s = series
493
513
0 commit comments