示例#1
0
 def test_start_date_should_be_immutable(self):
     date_range = DateRange(date(2011, 9, 28), date(2011, 9, 29))
     try:
         date_range.start_date = date(2011, 9, 27)
     except(AttributeError):
         pass
     else:
         self.fail()
示例#2
0
 def test_start_date_should_be_immutable(self):
     date_range = DateRange(date(2011, 9, 28), date(2011, 9, 29))
     try:
         date_range.start_date = date(2011, 9, 27)
     except (AttributeError):
         pass
     else:
         self.fail()
示例#3
0
 def test_constructor_should_reject_end_date_before_start_date(self):
     date_before = date(2011, 8, 31)
     date_after = date(2011, 9, 28)
     try:
         DateRange(date_after, date_before)
     except(ValueError):
         pass
     else:
         self.fail()
示例#4
0
 def test_constructor_should_reject_end_date_before_start_date(self):
     date_before = date(2011, 8, 31)
     date_after = date(2011, 9, 28)
     try:
         DateRange(date_after, date_before)
     except (ValueError):
         pass
     else:
         self.fail()
示例#5
0
 def test_constructor_should_reject_none_end_date(self):
     try:
         DateRange(date(2011, 9, 28), None)
     except(TypeError):
         pass
     else:
         self.fail()
示例#6
0
 def test_constructor_should_reject_none_end_date(self):
     try:
         DateRange(date(2011, 9, 28), None)
     except (TypeError):
         pass
     else:
         self.fail()
示例#7
0
 def test_constructor_should_reject_date_rime_end_date(self):
     try:
         DateRange(date(2011, 9, 28), datetime(2011, 9, 29))
     except (TypeError):
         pass
     else:
         self.fail()
     pass
示例#8
0
 def test_constructor_should_reject_date_rime_end_date(self):
     try:
         DateRange(date(2011, 9, 28), datetime(2011, 9, 29))
     except(TypeError):
         pass
     else:
         self.fail()
     pass
示例#9
0
 def test_end_date_should_return_constructed_Value(self):
     date_range = DateRange(date(2011, 9, 28), date(2011, 9, 29))
     self.assertEquals(date(2011, 9, 29), date_range.end_date)
示例#10
0
 def test_constructor_should_accept_end_date_same_as_start_date(self):
     DateRange(date(2011, 9, 28), date(2011, 9, 28))
示例#11
0
 def test_date_range_for_week_should_end_saturday(self):
     date_range = DateRange.for_week_containing(date(2011, 12, 7))
     self.assertEquals(date(2011, 12, 10), date_range.end_date)
示例#12
0
 def test_date_range_for_week_should_start_sunday(self):
     date_range = DateRange.for_week_containing(date(2011, 12, 7))
     self.assertEquals(date(2011, 12, 4), date_range.start_date)
示例#13
0
 def test_date_range_for_month_feb_should_end_feb_28(self):
     date_range = DateRange.for_month_containing(date(2011, 2, 11))
     self.assertEquals(date(2011, 2, 28), date_range.end_date)
示例#14
0
 def test_date_range_for_month_dec_should_end_dec_31(self):
     date_range = DateRange.for_month_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 12, 31), date_range.end_date)
示例#15
0
 def test_date_range_for_month_should_start_first_day_of_month(self):
     date_range = DateRange.for_month_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 12, 1), date_range.start_date)
示例#16
0
 def test_date_range_for_month_feb_should_end_feb_28(self):
     date_range = DateRange.for_month_containing(date(2011, 2, 11))
     self.assertEquals(date(2011, 2, 28), date_range.end_date)
示例#17
0
 def test_date_range_for_week_should_start_sunday(self):
     date_range = DateRange.for_week_containing(date(2011, 12, 7))
     self.assertEquals(date(2011, 12, 4), date_range.start_date)
示例#18
0
 def test_end_date_should_return_constructed_Value(self):
     date_range = DateRange(date(2011, 9, 28), date(2011, 9, 29))
     self.assertEquals(date(2011, 9, 29), date_range.end_date)
示例#19
0
 def test_date_range_for_week_should_end_saturday(self):
     date_range = DateRange.for_week_containing(date(2011, 12, 7))
     self.assertEquals(date(2011, 12, 10), date_range.end_date)
示例#20
0
 def test_constructor_should_accept_end_date_same_as_start_date(self):
     DateRange(date(2011, 9, 28), date(2011, 9, 28))
示例#21
0
 def test_date_range_for_month_should_start_first_day_of_month(self):
     date_range = DateRange.for_month_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 12, 1), date_range.start_date)
示例#22
0
 def test_date_range_for_month_dec_should_end_dec_31(self):
     date_range = DateRange.for_month_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 12, 31), date_range.end_date)
示例#23
0
 def test_date_range_for_year_should_start_jan_1(self):
     date_range = DateRange.for_year_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 1, 1), date_range.start_date)
示例#24
0
 def test_date_range_for_year_should_start_jan_1(self):
     date_range = DateRange.for_year_containing(date(2011, 12, 11))
     self.assertEquals(date(2011, 1, 1), date_range.start_date)