Esempio n. 1
0
    def test_feed_datetime(self):
        self.assertIsNone(
            feed_datetime(timetuple=None, allow_none=True, default=None))
        self.assertIsNotNone(
            feed_datetime(timetuple=None, allow_none=False, default=None))

        test_date = now()
        self.assertEqual(
            feed_datetime(timetuple=None, allow_none=False, default=test_date),
            test_date)

        self.assertAlmostEqual(feed_datetime(timetuple=test_date.timetuple()),
                               test_date,
                               delta=timedelta(seconds=1))
Esempio n. 2
0
 def test_feed_datetime_not_none(self):
     # test feed_datetime, ensure timetuple returns datetime
     time_hack_tuple = now().timetuple()  # timezone aware
     self.assertTrue(isinstance(feed_datetime(time_hack_tuple), datetime))
Esempio n. 3
0
 def test_feed_datetime_none(self):
     # test feed_datetime, ensure None values are handled right
     time_hack_tuple = None
     self.assertEqual(None, feed_datetime(time_hack_tuple, True))
     self.assertTrue(isinstance(feed_datetime(time_hack_tuple), datetime))