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


Python calendar.firstweekday方法代码示例

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


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

示例1: test_setfirstweekday

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def test_setfirstweekday(self):
        self.assertRaises(ValueError, calendar.setfirstweekday, 'flabber')
        self.assertRaises(ValueError, calendar.setfirstweekday, -1)
        self.assertRaises(ValueError, calendar.setfirstweekday, 200)
        orig = calendar.firstweekday()
        calendar.setfirstweekday(calendar.SUNDAY)
        self.assertEqual(calendar.firstweekday(), calendar.SUNDAY)
        calendar.setfirstweekday(calendar.MONDAY)
        self.assertEqual(calendar.firstweekday(), calendar.MONDAY)
        calendar.setfirstweekday(orig) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:12,代码来源:test_calendar.py

示例2: test_itermonthdays

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def test_itermonthdays(self):
        for firstweekday in range(7):
            cal = calendar.Calendar(firstweekday)
            # Test the extremes, see #28253 and #26650
            for y, m in [(1, 1), (9999, 12)]:
                days = list(cal.itermonthdays(y, m))
                self.assertIn(len(days), (35, 42))
        # Test a short month
        cal = calendar.Calendar(firstweekday=3)
        days = list(cal.itermonthdays(2001, 2))
        self.assertEqual(days, list(range(1, 29))) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:13,代码来源:test_calendar.py

示例3: test_itermonthdays2

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def test_itermonthdays2(self):
        for firstweekday in range(7):
            cal = calendar.Calendar(firstweekday)
            # Test the extremes, see #28253 and #26650
            for y, m in [(1, 1), (9999, 12)]:
                days = list(cal.itermonthdays2(y, m))
                self.assertEqual(days[0][1], firstweekday)
                self.assertEqual(days[-1][1], (firstweekday - 1) % 7) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:10,代码来源:test_calendar.py

示例4: setUp

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def setUp(self):
        self.oldfirstweekday = calendar.firstweekday()
        calendar.setfirstweekday(self.firstweekday) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:5,代码来源:test_calendar.py

示例5: test_setfirstweekday

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def test_setfirstweekday(self):
        self.assertRaises(TypeError, calendar.setfirstweekday, 'flabber')
        self.assertRaises(ValueError, calendar.setfirstweekday, -1)
        self.assertRaises(ValueError, calendar.setfirstweekday, 200)
        orig = calendar.firstweekday()
        calendar.setfirstweekday(calendar.SUNDAY)
        self.assertEqual(calendar.firstweekday(), calendar.SUNDAY)
        calendar.setfirstweekday(calendar.MONDAY)
        self.assertEqual(calendar.firstweekday(), calendar.MONDAY)
        calendar.setfirstweekday(orig) 
开发者ID:Microvellum,项目名称:Fluid-Designer,代码行数:12,代码来源:test_calendar.py

示例6: wkst

# 需要导入模块: import calendar [as 别名]
# 或者: from calendar import firstweekday [as 别名]
def wkst(self):
        """
        The week start day.  The default week start is got from
        calendar.firstweekday() which Joyous sets based on the Django
        FIRST_DAY_OF_WEEK format.
        """
        return Weekday(self.rule._wkst) 
开发者ID:linuxsoftware,项目名称:ls.joyous,代码行数:9,代码来源:recurrence.py


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