aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests
diff options
context:
space:
mode:
Diffstat (limited to 'python/tests')
-rw-r--r--python/tests/test_index.py11
1 files changed, 11 insertions, 0 deletions
diff --git a/python/tests/test_index.py b/python/tests/test_index.py
index 58505cc8..1d0bde77 100644
--- a/python/tests/test_index.py
+++ b/python/tests/test_index.py
@@ -7,6 +7,17 @@ from pyisda.flat_hazard import pv_vec
from analytics import Index, ForwardIndex
from analytics.index import g
+import pickle
+
+class TestPickle(unittest.TestCase):
+ index = Index.from_name("ig", 26, "5yr",
+ trade_date = datetime.date(2016, 7, 1))
+ index.notional = 50e6
+ index.spread = 75
+
+ def test_pickle(self):
+ a = pickle.loads(pickle.dumps(self.index))
+ self.assertTrue(hash(a) == hash(self.index))
class TestStrike(unittest.TestCase):
index = Index.from_name("ig", 26, "5yr",