当前位置: 首页>>代码示例>>Python>>正文


Python Delorean.next_week方法代码示例

本文整理汇总了Python中delorean.Delorean.next_week方法的典型用法代码示例。如果您正苦于以下问题:Python Delorean.next_week方法的具体用法?Python Delorean.next_week怎么用?Python Delorean.next_week使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在delorean.Delorean的用法示例。


在下文中一共展示了Delorean.next_week方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DeloreanTests

# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import next_week [as 别名]

#.........这里部分代码省略.........

    def test_move_namedday(self):
        dt_next = datetime(2013, 1, 4, 4, 31, 14, 148546, tzinfo=utc)
        dt_next_2 = datetime(2013, 1, 11, 4, 31, 14, 148546, tzinfo=utc)
        dt_last = datetime(2012, 12, 28, 4, 31, 14, 148546, tzinfo=utc)
        dt_last_2 = datetime(2012, 12, 21, 4, 31, 14, 148546, tzinfo=utc)

        d_obj_next = self.do.next_friday()
        d_obj_next_2 = self.do.next_friday(2)
        d_obj_last = self.do.last_friday()
        d_obj_last_2 = self.do.last_friday(2)

        self.assertEqual(dt_next, d_obj_next.datetime)
        self.assertEqual(dt_last, d_obj_last.datetime)
        self.assertEqual(dt_next_2, d_obj_next_2.datetime)
        self.assertEqual(dt_last_2, d_obj_last_2.datetime)

    def test_move_namedday_function(self):
        dt_next = datetime(2013, 1, 4, 4, 31, 14, 148546, tzinfo=utc)
        dt_last = datetime(2012, 12, 28, 4, 31, 14, 148546, tzinfo=utc)

        d_obj_next = move_datetime_namedday(self.do.datetime, 'next', 'friday')
        d_obj_last = move_datetime_namedday(self.do.datetime, 'last', 'friday')

        self.assertEqual(dt_next, d_obj_next)
        self.assertEqual(dt_last, d_obj_last)

    def test_move_week(self):
        dt_next = datetime(2013, 1, 10, 4, 31, 14, 148546, tzinfo=utc)
        dt_next_2 = datetime(2013, 1, 17, 4, 31, 14, 148546, tzinfo=utc)
        dt_last = datetime(2012, 12, 27, 4, 31, 14, 148546, tzinfo=utc)
        dt_last_2 = datetime(2012, 12, 20, 4, 31, 14, 148546, tzinfo=utc)

        d_obj_next = self.do.next_week()
        d_obj_next_2 = self.do.next_week(2)
        d_obj_last = self.do.last_week()
        d_obj_last_2 = self.do.last_week(2)

        self.assertEqual(dt_next, d_obj_next.datetime)
        self.assertEqual(dt_last, d_obj_last.datetime)
        self.assertEqual(dt_next_2, d_obj_next_2.datetime)
        self.assertEqual(dt_last_2, d_obj_last_2.datetime)

    def test_move_week_function(self):
        dt_next = datetime(2013, 1, 10, 4, 31, 14, 148546, tzinfo=utc)
        dt_last = datetime(2012, 12, 27, 4, 31, 14, 148546, tzinfo=utc)

        d_obj_next = move_datetime_week(self.do.datetime, 'next', 1)
        d_obj_last = move_datetime_week(self.do.datetime, 'last', 1)

        self.assertEqual(dt_next, d_obj_next)
        self.assertEqual(dt_last, d_obj_last)

    def test_move_month(self):
        dt_next = datetime(2013, 2, 3, 4, 31, 14, 148546, tzinfo=utc)
        dt_next_2 = datetime(2013, 3, 3, 4, 31, 14, 148546, tzinfo=utc)
        dt_last = datetime(2012, 12, 3, 4, 31, 14, 148546, tzinfo=utc)
        dt_last_2 = datetime(2012, 11, 3, 4, 31, 14, 148546, tzinfo=utc)

        d_obj_next = self.do.next_month()
        d_obj_next_2 = self.do.next_month(2)
        d_obj_last = self.do.last_month()
        d_obj_last_2 = self.do.last_month(2)

        self.assertEqual(dt_next, d_obj_next.datetime)
        self.assertEqual(dt_last, d_obj_last.datetime)
开发者ID:shussain,项目名称:delorean,代码行数:70,代码来源:test_data.py


注:本文中的delorean.Delorean.next_week方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。