Python calendar.firstweekday() Examples
The following are 25
code examples of calendar.firstweekday().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
calendar
, or try the search function
.
Example #1
Source File: test_calendar.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 6 votes |
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)
Example #2
Source File: test_calendar.py From oss-ftp with MIT License | 6 votes |
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)
Example #3
Source File: test_calendar.py From Fluid-Designer with GNU General Public License v3.0 | 6 votes |
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)
Example #4
Source File: test_calendar.py From medicare-demo with Apache License 2.0 | 6 votes |
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)
Example #5
Source File: test_calendar.py From ironpython3 with Apache License 2.0 | 6 votes |
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)
Example #6
Source File: test_calendar.py From gcblue with BSD 3-Clause "New" or "Revised" License | 6 votes |
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)
Example #7
Source File: test_calendar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 6 votes |
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)
Example #8
Source File: test_calendar.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #9
Source File: test_calendar.py From ironpython2 with Apache License 2.0 | 5 votes |
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)
Example #10
Source File: test_calendar.py From CTFCrackTools with GNU General Public License v3.0 | 5 votes |
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)
Example #11
Source File: recurrence.py From ls.joyous with BSD 3-Clause "New" or "Revised" License | 5 votes |
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)
Example #12
Source File: test_calendar.py From CTFCrackTools-V2 with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #13
Source File: test_calendar.py From medicare-demo with Apache License 2.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #14
Source File: test_calendar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #15
Source File: test_calendar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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)
Example #16
Source File: test_calendar.py From Project-New-Reign---Nemesis-Main with GNU General Public License v3.0 | 5 votes |
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)))
Example #17
Source File: test_calendar.py From gcblue with BSD 3-Clause "New" or "Revised" License | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #18
Source File: test_calendar.py From ironpython3 with Apache License 2.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #19
Source File: test_calendar.py From Fluid-Designer with GNU General Public License v3.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #20
Source File: test_calendar.py From oss-ftp with MIT License | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #21
Source File: test_calendar.py From BinderFilter with MIT License | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #22
Source File: test_calendar.py From BinderFilter with MIT License | 5 votes |
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)
Example #23
Source File: test_calendar.py From ironpython2 with Apache License 2.0 | 5 votes |
def setUp(self): self.oldfirstweekday = calendar.firstweekday() calendar.setfirstweekday(self.firstweekday)
Example #24
Source File: test_calendar.py From ironpython2 with Apache License 2.0 | 5 votes |
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)
Example #25
Source File: test_calendar.py From ironpython2 with Apache License 2.0 | 5 votes |
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)))