Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def test_datetime_param_monthly(self):
data = Monthly()
results = data.dataset.dates(use_datetime=True)
self.assertEqual(results[0], datetime.date(2013, 2, 1))
self.assertEqual(results[-1], datetime.date(2013, 8, 1))
def test_mavg_datetime(self):
data = ModelledVarMAVG()
dt = lambda x: datetime.date(x, 1, 1)
expected = [(dt(2020), dt(2039)), (dt(2040), dt(2059))]
self.assertEqual(data.dataset.dates(use_datetime=True), expected)
def test_stat(self):
data = ModelledStat()
expected = [("2046", "2065")]
self.assertEqual(data.dataset.dates(), expected)
def test_aanom_datetime(self):
data = ModelledVarAANOM()
dt = lambda x: datetime.date(x, 1, 1)
expected = [(dt(2020), dt(2039)), (dt(2060), dt(2079))]
self.assertEqual(data.dataset.dates(use_datetime=True), expected)
def test_mavg(self):
data = ModelledVarMAVG()
expected = [("2020", "2039"), ("2040", "2059")]
self.assertEqual(data.dataset.dates(), expected)
def test_datetime_param_quarterly(self):
data = Quarterly()
results = data.dataset.dates(use_datetime=True)
self.assertEqual(results[0], datetime.date(2011, 4, 1))
self.assertEqual(results[-1], datetime.date(2013, 7, 1))
def test_datetime_param_yearly(self):
data = Yearly()
results = data.dataset.dates(use_datetime=True)
expected = [datetime.date(2011, 1, 1), datetime.date(2012, 1, 1)]
self.assertEqual(results, expected)
def test_aanom(self):
data = ModelledVarAANOM()
expected = [("2020", "2039"), ("2060", "2079")]
self.assertEqual(data.dataset.dates(), expected)