def test_time_period_from_date(self, fixture): start, when, resolution, result, date = fixture start_date = helpers.parse_isodate(start) when_date = helpers.parse_isodate(when) if result is throws: with self.assertRaises(ValueError): TimePeriod.from_date(start_date, resolution, when_date) else: tp_date = helpers.parse_isodate(date) exp = TimePeriod(resolution, result, tp_date) self.assertEqual(TimePeriod.from_date(start_date, resolution, when_date), exp)