Exemplo n.º 1
0
 def published_naturaldate(self):
     date = self.published
     as_datetime = datetime(
         date.year,
         date.month,
         date.day,
         tzinfo=timezone.utc
     )
     return str(naturaldate(as_datetime))
Exemplo n.º 2
0
 def date_last_refresh_naturaldate(self):
     return str(naturaldate(self.date_last_refresh))
Exemplo n.º 3
0
 def updated_naturaldate(self):
     return str(naturaldate(self.updated))
Exemplo n.º 4
0
 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))
Exemplo n.º 5
0
 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))
Exemplo n.º 6
0
 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))