22from functools import partial
33from io import StringIO
44
5+ from dateutil .tz import tzlocal
56import numpy as np
67import pytest
78import pytz
@@ -480,6 +481,11 @@ def test_upsample_with_limit():
480481@pytest .mark .parametrize ("rule" , ["Y" , "3M" , "15D" , "30H" , "15Min" , "30S" ])
481482def test_nearest_upsample_with_limit (tz_aware_fixture , freq , rule ):
482483 # 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
483489 rng = date_range ("1/1/2000" , periods = 3 , freq = freq , tz = tz_aware_fixture )
484490 ts = Series (np .random .randn (len (rng )), rng )
485491
@@ -488,6 +494,20 @@ def test_nearest_upsample_with_limit(tz_aware_fixture, freq, rule):
488494 tm .assert_series_equal (result , expected )
489495
490496
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+
491511def test_resample_ohlc (series ):
492512 s = series
493513
0 commit comments