From d4a8878c6e47a518c1d14f0ea114640792c7db7b Mon Sep 17 00:00:00 2001 From: Eddie Hebert Date: Fri, 26 Apr 2013 10:56:54 -0400 Subject: [PATCH] TST: Ensure holiday edge case is covered in dividend performance test. Add a test suite of dividend performance that ensures a holiday is covered, needed because tests usually go over a random test range, so holiday coverage isn't covered in basic test. From @fawce. --- tests/test_perf_tracking.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tests/test_perf_tracking.py b/tests/test_perf_tracking.py index 22a4d070..9e2ccd1f 100644 --- a/tests/test_perf_tracking.py +++ b/tests/test_perf_tracking.py @@ -372,6 +372,23 @@ class TestDividendPerformance(unittest.TestCase): self.assertEqual(cumulative_cash_flows, [0, 0, 0, 0, 0]) +class TestDividendPerformanceHolidayStyle(TestDividendPerformance): + + # The holiday tests begins the simulation on the day + # before Thanksgiving, so that the next trading day is + # two days ahead. Any tests that hard code events + # to be start + oneday will fail, since those events will + # be skipped by the simulation. + + def setUp(self): + self.dt = datetime.datetime(2003, 11, 30, tzinfo=pytz.utc) + self.end_dt = datetime.datetime(2004, 11, 25, tzinfo=pytz.utc) + self.sim_params = SimulationParameters( + self.dt, + self.end_dt) + self.benchmark_events = benchmark_events_in_range(self.sim_params) + + class TestPositionPerformance(unittest.TestCase): def setUp(self):