def test_tenor_of_month(self): self.assertEqual(Tenor.IN_1_MONTH, Tenor.of_month(1)) self.assertEqual(Tenor.IN_2_MONTHS, Tenor.of_month(2)) self.assertEqual(Tenor.IN_3_MONTHS, Tenor.of_month(3)) self.assertEqual(Tenor.IN_9_MONTHS, Tenor.of_month(9)) self.assertEqual(Tenor.IN_18_MONTHS, Tenor.of_month(18)) self.assertEqual(Tenor.IN_30_MONTHS, Tenor.of_month(30))
def test_tenor_of_month_fails_at_19(self): with self.assertRaises(PricingError) as error: Tenor.of_month(19) self.assertEqual("invalid monthly tenor of 19 months", str(error.exception))