Exemplo n.º 1
0
 def test_rfc2822_date_without_time(self):
     """
     Test rfc2822_date() correctly formats date objects.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(datetime.date(2008, 11, 14)),
         "Fri, 14 Nov 2008 00:00:00 -0000")
Exemplo n.º 2
0
 def test_rfc2822_date(self):
     """
     Test rfc2822_date() correctly formats datetime objects.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(
             datetime.datetime(2008, 11, 14, 13, 37, 0)),
         "Fri, 14 Nov 2008 13:37:00 -0000")
Exemplo n.º 3
0
 def test_rfc2822_date_without_time(self):
     """
     Test rfc2822_date() correctly formats date objects.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(datetime.date(2008, 11, 14)),
         "Fri, 14 Nov 2008 00:00:00 -0000"
     )
Exemplo n.º 4
0
 def test_rfc2822_date_with_timezone(self):
     """
     Test rfc2822_date() correctly formats datetime objects with tzinfo.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0, tzinfo=FixedOffset(datetime.timedelta(minutes=60)))),
         "Fri, 14 Nov 2008 13:37:00 +0100"
     )
Exemplo n.º 5
0
 def test_rfc2822_date(self):
     """
     Test rfc2822_date() correctly formats datetime objects.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(datetime.datetime(2008, 11, 14, 13, 37, 0)),
         "Fri, 14 Nov 2008 13:37:00 -0000"
     )
def build_expected_result(feed, expected_result, encoding):
    # Result's date is of course different from the date in the fixture.
    # So make them equal!
    d = feedgenerator.rfc2822_date(feed.latest_post_date())
    s = expected_result.replace('%DATE%', d)
    if encoding:
        return s.encode(encoding)
    else:
        return s
Exemplo n.º 7
0
def build_expected_rss_result(feed, expected_result, encoding):
    # Result's date is of course different from the date in the fixture.
    # So make them equal!
    d = feedgenerator.rfc2822_date(feed.latest_post_date())
    s = expected_result.replace('%DATE%', d)
    if encoding:
        return s.encode(encoding)
    else:
        return s
Exemplo n.º 8
0
 def test_rfc2822_date_with_timezone(self):
     """
     Test rfc2822_date() correctly formats datetime objects with tzinfo.
     """
     self.assertEqual(
         feedgenerator.rfc2822_date(
             datetime.datetime(2008,
                               11,
                               14,
                               13,
                               37,
                               0,
                               tzinfo=FixedOffset(
                                   datetime.timedelta(minutes=60)))),
         "Fri, 14 Nov 2008 13:37:00 +0100")