Skip to content

Commit

Permalink
added DST testcase
Browse files Browse the repository at this point in the history
  • Loading branch information
rwijtvliet committed Feb 14, 2024
1 parent 5881ae7 commit fb28ece
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion tests/tools/test_intersect_flex.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
from typing import Iterable, Union

import pandas as pd
import pytest

from portfolyo import testing, tools


COMMON_END = "2022-02-02"

TESTCASES = [ # startdates, freq, expected_startdate
Expand Down Expand Up @@ -285,3 +285,15 @@ def do_test_intersect_index(
)
testing.assert_index_equal(out_a, expected_a)
testing.assert_index_equal(out_b, expected_b)


def test_intersect_flex_dst():
"""Test if intersection keeps working if DST-boundary is right at end."""
i1 = pd.date_range("2020", "2020-03-29", freq="D", tz="Europe/Berlin")
i2 = pd.date_range("2020", "2020-03-30", freq="D", tz="Europe/Berlin")

expected = pd.date_range("2020", "2020-03-29", freq="D", tz="Europe/Berlin")

result1, result2 = tools.intersect.indices_flex(i1, i2)
testing.assert_index_equal(result1, expected)
testing.assert_index_equal(result2, expected)

0 comments on commit fb28ece

Please sign in to comment.