diff --git a/test/test_credit_termstructures.py b/test/test_credit_termstructures.py index 64f253435..52ba98cbf 100644 --- a/test/test_credit_termstructures.py +++ b/test/test_credit_termstructures.py @@ -80,7 +80,7 @@ def test_piecewise_methods(self): if interpolator == Interpolator.LogLinear and \ trait in [ProbabilityTrait.HazardRate, ProbabilityTrait.DefaultDensity]: - with self.assertRaisesRegexp(RuntimeError, + with self.assertRaisesRegex(RuntimeError, 'LogInterpolation primitive not implemented'): curve.survival_probability(self.d) else: @@ -163,7 +163,7 @@ def test_create_interpolated_hazard(self): interpolated_curve = InterpolatedHazardRateCurve(trait, dates, hazard_rates, Actual365Fixed()) - with self.assertRaisesRegexp(RuntimeError, + with self.assertRaisesRegex(RuntimeError, 'LogInterpolation primitive not implemented'): hazard_rate = interpolated_curve.survival_probability(interpolation_date) diff --git a/test/test_daycounter.py b/test/test_daycounter.py index 39fceaf30..6136bc96a 100644 --- a/test/test_daycounter.py +++ b/test/test_daycounter.py @@ -35,7 +35,7 @@ def test_daycounter_name(self): def test_empty_daycounter(self): day_counter = DayCounter() - with self.assertRaisesRegexp(RuntimeError, r"no (day counter )?implementation provided"): + with self.assertRaisesRegex(RuntimeError, r"no (day counter )?implementation provided"): day_counter.name class TestDayCounterFromName(unittest.TestCase): diff --git a/test/test_quotes.py b/test/test_quotes.py index e438493ad..5bb009a12 100644 --- a/test/test_quotes.py +++ b/test/test_quotes.py @@ -16,13 +16,13 @@ def test_round_trip(self): def test_empty_constructor(self): quote = SimpleQuote() self.assertFalse(quote.is_valid) - with self.assertRaisesRegexp(RuntimeError, 'invalid SimpleQuote'): + with self.assertRaisesRegex(RuntimeError, 'invalid SimpleQuote'): x = quote.value # test quote reset quote.value = 1. quote.reset() self.assertFalse(quote.is_valid) - with self.assertRaisesRegexp(RuntimeError, 'invalid SimpleQuote'): + with self.assertRaisesRegex(RuntimeError, 'invalid SimpleQuote'): x = quote.value class FuturesConvAdjustmentTestCase(unittest.TestCase): diff --git a/test/test_rate_helpers.py b/test/test_rate_helpers.py index a41d3f2f4..c967df803 100644 --- a/test/test_rate_helpers.py +++ b/test/test_rate_helpers.py @@ -641,7 +641,7 @@ def assertImpliedQuotes( # Trigger bootstrap discount_at_origin = term_structure.discount(settlement_date) - self.assertAlmostEquals( + self.assertAlmostEqual( first=discount_at_origin, second=1.0, delta=eps) for q, h in zip(self.cross_currency_basis_quotes, helpers): @@ -657,7 +657,7 @@ def assertImpliedQuotes( actual_rate=actual_rate, expected_rate=expected_rate, tolerance=eps) - self.assertAlmostEquals( + self.assertAlmostEqual( first=actual_rate, second=expected_rate, delta=eps, diff --git a/test/test_schedule.py b/test/test_schedule.py index b0c1de6f4..5cceb0978 100644 --- a/test/test_schedule.py +++ b/test/test_schedule.py @@ -120,13 +120,13 @@ def test_schedule_from_dates(self): calendar, convention, termination_convention, tenor, rule) expected_date = Date(3, Sep, 2011) - self.assert_(expected_date == schedule.next_date(Date(3, Sep, 2011))) + self.assertEqual(expected_date, schedule.next_date(Date(3, Sep, 2011))) expected_date = Date(5, Nov, 2011) - self.assert_(expected_date == schedule.next_date(Date(4, Sep, 2011))) + self.assertEqual(expected_date, schedule.next_date(Date(4, Sep, 2011))) expected_date = Date(15, Dec, 2011) - self.assert_(expected_date == schedule.next_date(Date(6, Nov, 2011))) + self.assertEqual(expected_date, schedule.next_date(Date(6, Nov, 2011))) if __name__ == '__main__': unittest.main()