本文整理汇总了Python中delorean.Delorean.next_friday方法的典型用法代码示例。如果您正苦于以下问题:Python Delorean.next_friday方法的具体用法?Python Delorean.next_friday怎么用?Python Delorean.next_friday使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类delorean.Delorean
的用法示例。
在下文中一共展示了Delorean.next_friday方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: DeloreanTests
# 需要导入模块: from delorean import Delorean [as 别名]
# 或者: from delorean.Delorean import next_friday [as 别名]
#.........这里部分代码省略.........
do = Delorean()
do.truncate('minute')
dt1 = datetime_timezone(UTC)
self.assertEqual(dt1.replace(second=0, microsecond=0), do.datetime)
def test_datetime_timezone(self):
do = Delorean(timezone="US/Eastern")
do.truncate("minute")
dt1 = datetime_timezone(tz="US/Eastern")
self.assertEqual(dt1.replace(second=0, microsecond=0), do.datetime)
def test_parse(self):
do = parse('Thu Sep 25 10:36:28 BRST 2003')
dt1 = utc.localize(datetime(2003, 9, 25, 10, 36, 28))
self.assertEqual(do.datetime, dt1)
def test_parse_with_utc_year_fill(self):
do = parse('Thu Sep 25 10:36:28')
dt1 = utc.localize(datetime(2013, 9, 25, 10, 36, 28))
self.assertEqual(do.datetime, dt1)
def test_parse_with_timezone_year_fill(self):
do = parse('Thu Sep 25 10:36:28')
dt1 = utc.localize(datetime(2013, 9, 25, 10, 36, 28))
self.assertEqual(do.datetime, dt1)
self.assertEqual(do._tz, "UTC")
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)