macros_test.py 文件源码

python
阅读 21 收藏 0 点赞 0 评论 0

项目:filters 作者: eflglobal 项目源码 文件源码
def test_partial(self):
        """
        You can use Filter macros to create partials from other Filter
        types.
        """
        MyDatetime = filter_macro(f.Datetime, timezone=12)

        self.assertEqual(
            MyDatetime().apply('2015-10-13 15:22:18'),

            # By default, MyDatetime assumes a timezone of UTC+12...
            datetime(2015, 10, 13, 3, 22, 18, tzinfo=utc),
        )

        self.assertEqual(
            # ... however, we can override it.
            MyDatetime(timezone=6).apply('2015-10-13 15:22:18'),

            datetime(2015, 10, 13, 9, 22, 18, tzinfo=utc),
        )
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号