def published_naturaldate(self): date = self.published as_datetime = datetime( date.year, date.month, date.day, tzinfo=timezone.utc ) return str(naturaldate(as_datetime))
def date_last_refresh_naturaldate(self): return str(naturaldate(self.date_last_refresh))
def updated_naturaldate(self): return str(naturaldate(self.updated))
def test_updated_naturaldate(self): now = datetime.now(pytz.utc) post = Post(feed=self.feed, title="baz", updated=now) self.assertEqual(post.updated_naturaldate, naturaldate(now))
def test_published_naturaldate(self): now = datetime.now(pytz.utc) day = datetime(now.year, now.month, now.day, tzinfo=utc) post = Post(feed=self.feed, title="baz", published=now) self.assertEqual(post.published_naturaldate, naturaldate(day))
def test_date_last_refresh_naturaldate(self): now = datetime.now(pytz.utc) f = Feed(title="foo2", feed_url="requests.codes.//example.com/t2.rss", date_last_refresh=now) self.assertEqual(f.date_last_refresh_naturaldate, naturaldate(now))