diff options
Diffstat (limited to 'python/tests')
| -rw-r--r-- | python/tests/test_index.py | 12 | ||||
| -rw-r--r-- | python/tests/test_scenarios.py | 4 | ||||
| -rw-r--r-- | python/tests/test_swaption.py | 2 |
3 files changed, 4 insertions, 14 deletions
diff --git a/python/tests/test_index.py b/python/tests/test_index.py index d9dbf868..3b15cce8 100644 --- a/python/tests/test_index.py +++ b/python/tests/test_index.py @@ -3,7 +3,6 @@ import datetime import numpy as np from pyisda.cdsone import upfront_charge -from pyisda.flat_hazard import pv_vec from analytics import CreditIndex, ForwardIndex from analytics.index import g @@ -40,17 +39,6 @@ class TestStrike(unittest.TestCase): self.index._update() self.assertAlmostEqual(self.index.clean_pv, strike) - def test_strike_vec(self): - self.index.value_date = datetime.date(2016, 8, 19) - r = pv_vec(np.array([70, 75])*1e-4, self.index._yc, self.index.value_date, - self.index._cash_settle_date, self.index.start_date, self.index.end_date, - self.index.recovery, self.index.fixed_rate * 1e-4) - self.index.notional = 1 - self.index.spread = 70 - self.assertAlmostEqual(self.index.clean_pv, r[0]) - self.index.spread = 75 - self.assertAlmostEqual(self.index.clean_pv, r[1]) - def test_price_setting(self): self.index.price = self.index.price self.assertAlmostEqual(self.index.spread, 75) diff --git a/python/tests/test_scenarios.py b/python/tests/test_scenarios.py index 6536c97e..1f1f6bf3 100644 --- a/python/tests/test_scenarios.py +++ b/python/tests/test_scenarios.py @@ -2,7 +2,8 @@ import unittest import numpy as np import pandas as pd -from analytics import CreditIndex, BlackSwaption, Portfolio, BlackSwaptionVolSurface +from analytics import (CreditIndex, BlackSwaption, Portfolio, + BlackSwaptionVolSurface) from pandas.tseries.offsets import BDay from analytics.scenarios import (run_portfolio_scenarios, run_swaption_scenarios, run_index_scenarios) @@ -37,5 +38,6 @@ class TestSenarios(unittest.TestCase): df_orig = df_orig.set_index('vol_shock', append=True) self.assertFalse(np.any((df.sum(axis=1).values-df_orig['pnl'].values))) + if __name__ == "__main__": unittest.main() diff --git a/python/tests/test_swaption.py b/python/tests/test_swaption.py index 211d0e49..40237b79 100644 --- a/python/tests/test_swaption.py +++ b/python/tests/test_swaption.py @@ -89,7 +89,7 @@ class TestBreakeven(unittest.TestCase): self.igstrike, "receiver") receiver.sigma = .4 receiver.notional = 1e7 - self.assertAlmostEqual(receiver.breakeven, 73.715942707132982) + self.assertAlmostEqual(receiver.breakeven, 73.71594264020226) if __name__ == "__main__": unittest.main() |
