def test_valid(self): tests = ( (quarter(2014, 1), (2014, 1, 1), (2014, 3, 31)), (quarter(2001, 2), (2001, 4, 1), (2001, 6, 30)), (quarter(2015, 3), (2015, 7, 1), (2015, 9, 30)), (quarter(2016, 4), (2016, 10, 1), (2016, 12, 31)), ) for actual, start, end in tests: start = local_datetime(start) end = local_datetime(end) self.assertEqual(actual[0], start) self.assertEqual(actual[1], end)
def test_invalid(self): self.assertRaises(ValueError, lambda: quarter(2015, 6))