def test_merge_by_year_type(self): with self.assertRaises(KeyError) as mby: merge_by_year(countries, income, 'A') mby.exception self.assertEquals(str(mby.exception), 'Invalid input type.')
def test_merge_by_year_value(self): with self.assertRaises(KeyError) as mby: merge_by_year(countries, income, '1700') mby.exception self.assertEquals(str(mby.exception), 'Invalid year.')