コード例 #1
0
 def test_week_next_at_new_year(self):
     week = Week(datetime(year=2020, month=12, day=31))
     self.assertTrue(isinstance(week.next(), Week))
     self.assertEqual(week._datetime.year, 2020)
     self.assertEqual(week.number, 53)
     self.assertEqual(week.next()._datetime.year, 2021)
     self.assertEqual(week.next().number, 1)
コード例 #2
0
 def test_week_prev(self):
     week = Week(datetime(year=2020, month=11, day=5))
     self.assertEqual(week.prev().number, 44)
コード例 #3
0
 def test_name(self):
     week = Week(datetime(year=2021, month=3, day=18))
     self.assertEqual(week.name, '11 2021')
コード例 #4
0
 def test_first_week_of_year(self):
     week = Week(datetime(year=2021, month=1, day=8))
     monday, sunday = week.range()
     self.assertEqual('2021-01-04', str(monday))
     self.assertEqual(1, week.number)
コード例 #5
0
 def test_last_week_of_year(self):
     week = Week(datetime(year=2020, month=12, day=30))
     monday, sunday = week.range()
     self.assertEqual('2020-12-28', str(monday))
     self.assertEqual(53, week.number)
コード例 #6
0
 def test_sunday(self):
     week = Week(datetime(year=2020, month=11, day=6))
     monday, sunday = week.range()
     self.assertTrue(isinstance(sunday, Date))
     self.assertTrue(sunday.number, 8)
     self.assertEqual(45, week.number)
コード例 #7
0
 def test_monday(self):
     week = Week(datetime(year=2020, month=11, day=4))
     monday, sunday = week.range()
     self.assertTrue(isinstance(monday, Date))
     self.assertTrue(monday._datetime.day, 2)
     self.assertEqual('2020-11-02', str(monday))
コード例 #8
0
 def test_week_next(self):
     week = Week(datetime(year=2020, month=11, day=4))
     self.assertTrue(isinstance(week.next(), Week))
     self.assertEqual(week.next().number, 46)