Skip to content

Commit aef4263

Browse files
committed
✨ tests for #210
1 parent 3e56b2b commit aef4263

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

tests/test_figure_resampler.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -529,6 +529,7 @@ def test_hf_text_and_hf_hovertext():
529529
def test_multiple_timezones():
530530
n = 5_050
531531

532+
# NOTE: date-range returns a (tz-aware) DatetimeIndex
532533
dr = pd.date_range("2022-02-14", freq="s", periods=n, tz="UTC")
533534
dr_v = np.random.randn(n)
534535

@@ -538,6 +539,12 @@ def test_multiple_timezones():
538539
dr.tz_convert("Europe/Brussels"),
539540
dr.tz_convert("Australia/Perth"),
540541
dr.tz_convert("Australia/Canberra"),
542+
# NOTE: this pd.Series tests the functionality of a Pandas series with (tz-aware) DatetimeIndex
543+
pd.Series(dr),
544+
pd.Series(dr.tz_localize(None).tz_localize("Europe/Amsterdam")),
545+
pd.Series(dr.tz_convert("Europe/Brussels")),
546+
pd.Series(dr.tz_convert("Australia/Perth")),
547+
pd.Series(dr.tz_convert("Australia/Canberra")),
541548
]
542549

543550
plain_plotly_fig = make_subplots(rows=len(cs), cols=1, shared_xaxes=True)
@@ -564,7 +571,7 @@ def test_multiple_timezones():
564571
col=1,
565572
)
566573
# Assert that the time parsing is exactly the same
567-
assert plain_plotly_fig.data[0].x[0] == fr_fig.data[0].x[0]
574+
assert plain_plotly_fig.data[i-1].x[0] == fr_fig.data[i-1].x[0]
568575

569576

570577
def test_datetime_hf_x_no_index():

0 commit comments

Comments
 (0)