def test_return_naive_datetime(self):
"""
You can configure the filter to return a naive datetime object
(e.g., for storing in a database).
Note that the datetime is still converted to UTC before its
tzinfo is removed.
"""
self.assertFilterPasses(
self._filter(
datetime(
2015, 7, 1, 9, 22, 10,
tzinfo=tzoffset('UTC-5', -5*3600),
),
# Note that we pass `naive=True` to the Filter's
# initializer.
naive = True,
),
# The resulting datetime is converted to UTC before its
# timezone info is stripped.
datetime(2015, 7, 1, 14, 22, 10, tzinfo=None),
)
评论列表
文章目录