From 67f76e4d67ec736852e20ee499df0bbe04a3c5ab Mon Sep 17 00:00:00 2001 From: Scott Sanderson Date: Thu, 14 Jul 2016 17:38:58 -0400 Subject: [PATCH] PERF: Speed up event utils test case. Just take a sample of all 5000 permutations of 7 dates. --- tests/pipeline/test_events.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tests/pipeline/test_events.py b/tests/pipeline/test_events.py index 4b19a932..467c8da3 100644 --- a/tests/pipeline/test_events.py +++ b/tests/pipeline/test_events.py @@ -483,8 +483,13 @@ class EventLoaderUtilsTestCase(ZiplineTestCase): moscow_dates = pd.to_datetime(moscow_boundary_dates + mixed_tz_dates, utc=True).tz_localize(None) - combos = list(map(np.array, itertools.permutations(np.arange(len( - boundary_dates + mixed_tz_dates))))) + all_combos = list(map(np.array, itertools.permutations(np.arange(len( + boundary_dates + mixed_tz_dates) + )))) + # len(permutations(7)) is about 5000, which makes this take too long. + # Sampling down to 50-ish permutations still gives is good coverage of the + # different interleavings. + combos = all_combos[::100] expected_us = pd.Series( [pd.Timestamp('2013-01-04'),