Esempio n. 1
0
 def test_months_plural(self):
     # 2 months from self.start.
     end = datetime(2011, 3, 1)
     self.assertEqual(interval_string(self.start, end), "2 months")
Esempio n. 2
0
 def test_years(self):
     # 1 year from self.start.
     end = datetime(2012, 1, 1)
     self.assertEqual(interval_string(self.start, end), "1 year")
Esempio n. 3
0
 def test_weeks_plural(self):
     end = self.start + timedelta(weeks=2)
     self.assertEqual(interval_string(self.start, end), "2 weeks")
Esempio n. 4
0
 def test_months(self):
     # 1 month from self.start.
     end = datetime(2011, 2, 1)
     self.assertEqual(interval_string(self.start, end), "1 month")
Esempio n. 5
0
 def test_sub_second(self):
     end = self.start + timedelta(milliseconds=200)
     self.assertEqual(interval_string(self.start, end), "0 seconds")
Esempio n. 6
0
 def test_weeks(self):
     end = self.start + timedelta(weeks=1)
     self.assertEqual(interval_string(self.start, end), "1 week")
Esempio n. 7
0
 def test_hours_plural(self):
     end = self.start + timedelta(hours=2)
     self.assertEqual(interval_string(self.start, end), "2 hours")
Esempio n. 8
0
 def test_years_leap_year(self):
     # 2012 is a leap year.
     start = datetime(2012, 2, 29)
     end = datetime(2013, 3, 1)
     self.assertEqual(interval_string(start, end), "1 year")
Esempio n. 9
0
 def test_minutes_plural(self):
     end = self.start + timedelta(minutes=2)
     self.assertEqual(interval_string(self.start, end), "2 minutes")
Esempio n. 10
0
 def test_hours(self):
     end = self.start + timedelta(hours=1)
     self.assertEqual(interval_string(self.start, end), "1 hour")
Esempio n. 11
0
 def test_minutes(self):
     end = self.start + timedelta(minutes=1)
     self.assertEqual(interval_string(self.start, end), "1 minute")
Esempio n. 12
0
 def test_seconds_plural(self):
     end = self.start + timedelta(seconds=2)
     self.assertEqual(interval_string(self.start, end), "2 seconds")
Esempio n. 13
0
 def test_seconds(self):
     end = self.start + timedelta(seconds=1)
     self.assertEqual(interval_string(self.start, end), "1 second")
Esempio n. 14
0
 def test_years_plural(self):
     # 2 years from self.start.
     end = datetime(2013, 1, 1)
     self.assertEqual(interval_string(self.start, end), "2 years")
Esempio n. 15
0
 def test_days(self):
     end = self.start + timedelta(days=1)
     self.assertEqual(interval_string(self.start, end), "1 day")
Esempio n. 16
0
 def test_years_leap_year_short(self):
     # 2012 is a leap year.
     start = datetime(2012, 2, 29)
     end = datetime(2013, 2, 28)
     self.assertEqual(interval_string(start, end), "11 months")
Esempio n. 17
0
 def test_days_plural(self):
     end = self.start + timedelta(days=2)
     self.assertEqual(interval_string(self.start, end), "2 days")
Esempio n. 18
0
 def test_date_same_day(self):
     start = date(2012, 1, 1)
     end = date(2012, 2, 1)
     self.assertEqual(interval_string(start, end), "1 month")
Esempio n. 19
0
 def test_same(self):
     self.assertEqual(interval_string(self.start, self.start), "0 seconds")