def test_get_applicable_deals_returns_list_with_1_deal(self): event = Event('flood', 'Louisiana', 500, deals) event.deals_list = [] event.get_applicable_deals(deals) self.assertAlmostEqual(event.deals_list, [{ 'retention': 250, 'limit': 250, 'perils': ['hurricane', 'flood'], 'regions': ['Florida', 'Louisiana'] }])
def test_get_applicable_deals_returns_list_with_2_deal(self): event = Event('hurricane', 'Florida', 2000, deals) event.deals_list = [] event.get_applicable_deals(deals) self._baseAssertEqual(event.deals_list, [{ 'regions': ['Florida', 'Louisiana'], 'perils': ['hurricane', 'flood'], 'limit': 250, 'retention': 250 }, { 'regions': ['Florida'], 'perils': ['hurricane'], 'limit': 3000, 'retention': 1000 }])
def test_total_loss_returns_0_when_no_deal_exists_for_event(self): event = Event('hurricane', 'Minnesota', 2000, deals) event.deals_list = [] self.assertTrue(event.total_loss() == 0)
def test_get_applicable_deals_returns_empty_list_when_there_is_no_deal_for_event( self): event = Event('hurricane', 'Minnesota', 2000, deals) event.deals_list = ['dummy data'] event.get_applicable_deals(deals) self._baseAssertEqual(event.deals_list, [])