示例#1
0
 def test_represent_days_only(self):
     self.assertEqual('2 days', humanize_days(23, display_days=True))
示例#2
0
 def test_represent_months_only(self):
     self.assertEqual('1 month', humanize_days(32, display_months=True))
示例#3
0
 def test_represent_weeks_only(self):
     self.assertEqual('3 weeks', humanize_days(23, display_weeks=True))
示例#4
0
 def test_should_represent_negative_weeks(self):
     self.assertEqual('11 months, 4 weeks, 2 days', humanize_days(-365))
示例#5
0
 def test_represent_years_only(self):
     self.assertEqual('1 year', humanize_days(366, display_years=True))
示例#6
0
 def test_should_represent_negative_days(self):
     self.assertEqual('3 days', humanize_days(-3))
示例#7
0
 def test_should_represent_negative_weeks(self):
     self.assertEqual('4 weeks, 1 day', humanize_days(-29))
示例#8
0
 def test_should_represent_today(self):
     self.assertEqual('0 days', humanize_days(0))
示例#9
0
 def test_should_represent_negative_day(self):
     self.assertEqual('1 day', humanize_days(-1))
示例#10
0
 def test_should_obmit_days_if_zero(self):
     self.assertEqual('1 year, 1 week', humanize_days(372))
示例#11
0
 def test_should_represent_one_day(self):
     self.assertEqual('1 day', humanize_days(1))
示例#12
0
 def test_should_skip_months_if_less_than_a_month(self):
     self.assertEqual('4 weeks, 1 day', humanize_days(29))
示例#13
0
 def test_should_obmit_weeks_if_zero(self):
     self.assertEqual('1 year, 1 day', humanize_days(366))
示例#14
0
 def test_should_obmit_year_weeks_and_days_if_zero(self):
     self.assertEqual('11 months', humanize_days(334))
示例#15
0
 def test_should_skip_years_if_less_than_a_year(self):
     self.assertEqual('11 months, 4 weeks, 2 days', humanize_days(364))
示例#16
0
 def test_should_skip_weeks_and_days_if_zero(self):
     self.assertEqual('2 years', humanize_days(730))