From d2d9ef135992ca88426b91ce275cb1c0c0f062b0 Mon Sep 17 00:00:00 2001 From: fawce Date: Tue, 7 Aug 2012 17:55:27 -0400 Subject: [PATCH] removed a few debug calls --- tests/test_transforms.py | 33 ++++++++++++++++----------------- zipline/gens/returns.py | 5 ----- zipline/utils/test_utils.py | 1 - 3 files changed, 16 insertions(+), 23 deletions(-) diff --git a/tests/test_transforms.py b/tests/test_transforms.py index a7beac1f..9050086e 100644 --- a/tests/test_transforms.py +++ b/tests/test_transforms.py @@ -35,9 +35,9 @@ class FinanceTransformsTestCase(TestCase): self.log_handler.pop_application() def test_vwap(self): - + vwap = StatefulTransform( - VWAP, + VWAP, market_aware = False, delta = timedelta(days = 2) ) @@ -53,29 +53,29 @@ class FinanceTransformsTestCase(TestCase): ((10.0 * 100) + (11.0 * 100)) / (200.0), # We should drop the second event here. ((11.0 * 100) + (11.0 * 300)) / (400.0) - ] + ] # Output should match the expected. assert tnfm_vals == expected - + def test_returns(self): # Daily returns. returns = StatefulTransform(Returns, 1) - + transformed = list(returns.transform(self.source)) tnfm_vals = [message.tnfm_value for message in transformed] # No returns for the first event because we don't have a # previous close. expected = [None, 0.0, 0.1, 0.0] - + assert tnfm_vals == expected # Two-day returns. An extra kink here is that the # factory will automatically skip a weekend for the # last event. Results shouldn't notice this blip. - + trade_history = factory.create_trade_history( 133, [10.0, 15.0, 13.0, 12.0, 13.0], @@ -86,29 +86,28 @@ class FinanceTransformsTestCase(TestCase): self.source = SpecificEquityTrades(event_list=trade_history) returns = StatefulTransform(Returns, 2) - + transformed = list(returns.transform(self.source)) tnfm_vals = [message.tnfm_value for message in transformed] - + expected = [ None, - None, + None, (13.0 - 10.0) / 10.0, (12.0 - 15.0) / 15.0, (13.0 - 13.0) / 13.0 ] - - import nose.tools; nose.tools.set_trace() + assert tnfm_vals == expected - + def test_moving_average(self): mavg = StatefulTransform( - MovingAverage, + MovingAverage, market_aware = False, fields = ['price', 'volume'], - delta = timedelta(days = 2), - ) + delta = timedelta(days = 2), + ) transformed = list(mavg.transform(self.source)) # Output values. tnfm_prices = [message.tnfm_value.price for message in transformed] @@ -131,6 +130,6 @@ class FinanceTransformsTestCase(TestCase): # Second event should get dropped here. ((100.0 + 300.0) / 2.0) ] - + assert tnfm_prices == expected_prices assert tnfm_volumes == expected_volumes diff --git a/zipline/gens/returns.py b/zipline/gens/returns.py index dd83fe7f..055b9735 100644 --- a/zipline/gens/returns.py +++ b/zipline/gens/returns.py @@ -16,11 +16,6 @@ class Returns(object): """ assert event.has_key('dt') assert event.has_key('price') -<<<<<<< HEAD - -======= - ->>>>>>> 28e6dc15b0b5fc9767ea298c7a2d9cacc05b842e tracker = self.mapping[event.sid] tracker.update(event) diff --git a/zipline/utils/test_utils.py b/zipline/utils/test_utils.py index e94c49ee..036ebe02 100644 --- a/zipline/utils/test_utils.py +++ b/zipline/utils/test_utils.py @@ -113,7 +113,6 @@ def drain_receiver(receiver): def assert_single_position(test, zipline): - import nose.tools; nose.tools.set_trace() output, transaction_count = drain_zipline(test, zipline) test.assertEqual(