def test_YearView(self): view = views.YearView(self.entries, self.options_map, 'Year', 2013) self.assertNotEqual([], view.entries) self.assertNotEqual([], view.opening_entries) self.assertNotEqual([], view.closing_entries) self.assertNotEqual(self.empty_realization, view.real_accounts) self.assertNotEqual(self.empty_realization, view.opening_real_accounts) self.assertNotEqual(self.empty_realization, view.closing_real_accounts) view = views.YearView(self.entries, self.options_map, 'Year', 2013, 2) with self.assertRaises(ValueError): view = views.YearView(self.entries, self.options_map, 'Year', 2013, 0) with self.assertRaises(ValueError): view = views.YearView(self.entries, self.options_map, 'Year', 2013, 13)
def year(year=None, path=None): year = int(year) first_month = app.args.first_month return views.YearView(app.entries, app.options, 'Year {:4d}'.format(year), year, first_month)