Skip to content

Commit

Permalink
those deprecated methods were removed in Python 3.12
Browse files Browse the repository at this point in the history
  • Loading branch information
thrasibule committed May 24, 2024
1 parent eaddf93 commit a3e9a86
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 10 deletions.
4 changes: 2 additions & 2 deletions test/test_credit_termstructures.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)

Expand Down
2 changes: 1 addition & 1 deletion test/test_daycounter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions test/test_quotes.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions test/test_rate_helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions test/test_schedule.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

0 comments on commit a3e9a86

Please sign in to comment.