MAINT: Changes unittest use of ndict to use specific objects.

Instead of using ndict, changing over to using the objects that
are created used when an algorithm is run.
This commit is contained in:
Eddie Hebert
2013-03-06 15:48:01 -05:00
parent 2095679a1d
commit e53622c930
+7 -5
View File
@@ -24,14 +24,15 @@ from unittest import TestCase
from zipline.finance.slippage import VolumeShareSlippage
from zipline import ndict
from zipline.protocol import Event
from zipline.gens.tradesimulation import Order
class SlippageTestCase(TestCase):
def test_volume_share_slippage(self):
event = ndict(
event = Event(
{'volume': 200,
'TRANSACTION': None,
'type': 4,
@@ -51,7 +52,7 @@ class SlippageTestCase(TestCase):
slippage_model = VolumeShareSlippage()
open_orders = {133: [
ndict(
Order(
{'dt': datetime.datetime(2006, 1, 5, 14, 30, tzinfo=pytz.utc),
'amount': 100,
'filled': 0, 'sid': 133})
@@ -72,5 +73,6 @@ class SlippageTestCase(TestCase):
self.assertIsNotNone(txn)
for key, value in expected_txn.items():
self.assertEquals(value, txn[key])
# TODO: Make expected_txn an Transaction object and ensure there
# is a __eq__ for that class.
self.assertEquals(expected_txn, txn.__dict__)