def test_just_now(self): self.assertEqual(relativedate.since(datetime.now()), 'Just now')
def test_six_hours_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(hours=6)), '6 hours ago')
def test_invalid_type(self): self.assertIsNone(relativedate.since(None)) self.assertIsNone(relativedate.since("something")) self.assertIsNone(relativedate.since(1234))
def test_four_minutes_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(minutes=4)), '4 minutes ago')
def test_one_minute_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(minutes=1)), 'A few minutes ago')
def test_six_days_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=6)), '6 days ago')
def test_less_than_a_minute(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(seconds=40)), 'Less than a minute ago')
def test_ten_days_ago_expect_week(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=10)), '1 week ago')
def test_one_day_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=1)), '1 day ago')
def test_two_weeks_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=14)), '2 weeks ago')
def test_one_week_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=7)), '1 week ago')
def test_a_while_ago(self): self.assertEqual(relativedate.since(datetime.now() - timedelta(days=365)), 'A while ago')