def test_datetime(self): self.assertEqual(datetime("2015-03-25 12:34"), dt.datetime(2015, 3, 25, 12, 34)) self.assertEqual(datetime(2015, 3, 99, 23, 45), datetime(2015, 3, 31, 23, 45)) self.assertEqual(datetime.now().date(), dt.datetime.now().date()) self.assertEqual(datetime.now(bdays=-45).date(), (dt.datetime.now() - relativedelta(bdays=45)).date())
def test_datetime(self): self.assertEqual(datetime("2015-03-25 12:34"), dt.datetime(2015, 3, 25, 12, 34)) self.assertEqual(datetime(2015, 3, 99, 23, 45), datetime(2015, 3, 31, 23, 45)) self.assertEqual(datetime.now().date(), dt.datetime.now().date()) self.assertEqual( datetime.now(bdays=-45).date(), (dt.datetime.now() - relativedelta(bdays=45)).date())
def test_datetime(self): self.assertEqual(datetime("2015-03-25 12:34"), dt.datetime(2015, 3, 25, 12, 34)) self.assertEqual(datetime(2015, 3, 15, 23, 45).month_end(), datetime(2015, 3, 31, 23, 59, 59, 999999)) self.assertEqual(datetime.now().date(), dt.datetime.now().date()) self.assertEqual(datetime.now(bdays=-45).date(), (dt.datetime.now() - relativedelta(bdays=45)).date()) self.assertEqual(datetime(time("3:40")), dt.datetime.combine(dt.datetime.today(), dt.time(3, 40, 0)))