Пример #1
0
 def test_unified_timestamps(self):
     #Each serve as a different insertion for unified timestamp
     self.assertEqual(unified_timestamp('Feb 14th 2016 5:45PM'), 1455471900)
     self.assertEqual(unified_timestamp('March 15, 2017 at 7:49 am'),
                      1489564140)
     self.assertEqual(unified_timestamp('27.02.2016 17:30'), 1456594200)
     self.assertEqual(unified_timestamp('March 16, 2016 11:15 PM'),
                      1458170100)
     self.assertEqual(unified_timestamp('Sep 11, 2013 | 5:49 AM'),
                      1378878540)
Пример #2
0
 def test_unified_timestamps2(self):
     self.assertEqual(unified_timestamp('8/7/2009'), 1247011200)
     self.assertEqual(unified_timestamp('2012/10/11 01:56:38 +0000'),
                      1349920598)
     self.assertEqual(unified_timestamp('28/01/2014 21:00:00 +0100'),
                      1390939200)
     self.assertEqual(
         unified_timestamp('11/26/2014 11:30:00 AM PST', day_first=False),
         1417001400)
     self.assertEqual(
         unified_timestamp('2/2/2015 6:47:40 PM', day_first=False),
         1422902860)
Пример #3
0
    def extract_airdate(self, loader_data):
        airdate_str = loader_data.get('mediaMetadata', {}).get('agf', {}).get('airdate')

        if airdate_str is None:
            return None

        return unified_timestamp(airdate_str)
Пример #4
0
 def test_unified_timestamps(self):
     self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)
     self.assertEqual(unified_timestamp('8/7/2009'), 1247011200)
     self.assertEqual(unified_timestamp('Dec 14, 2012'), 1355443200)
     self.assertEqual(unified_timestamp('2012/10/11 01:56:38 +0000'), 1349920598)
     self.assertEqual(unified_timestamp('1968 12 10'), -33436800)
     self.assertEqual(unified_timestamp('1968-12-10'), -33436800)
     self.assertEqual(unified_timestamp('28/01/2014 21:00:00 +0100'), 1390939200)
     self.assertEqual(
         unified_timestamp('11/26/2014 11:30:00 AM PST', day_first=False),
         1417001400)
     self.assertEqual(
         unified_timestamp('2/2/2015 6:47:40 PM', day_first=False),
         1422902860)
     self.assertEqual(unified_timestamp('Feb 14th 2016 5:45PM'), 1455471900)
     self.assertEqual(unified_timestamp('25-09-2014'), 1411603200)
     self.assertEqual(unified_timestamp('27.02.2016 17:30'), 1456594200)
     self.assertEqual(unified_timestamp('UNKNOWN DATE FORMAT'), None)
     self.assertEqual(unified_timestamp('May 16, 2016 11:15 PM'), 1463440500)
     self.assertEqual(unified_timestamp('Feb 7, 2016 at 6:35 pm'), 1454870100)
Пример #5
0
 def test_unified_timestamps(self):
     self.assertEqual(unified_timestamp('December 21, 2010'), 1292889600)
     self.assertEqual(unified_timestamp('8/7/2009'), 1247011200)
     self.assertEqual(unified_timestamp('Dec 14, 2012'), 1355443200)
     self.assertEqual(unified_timestamp('2012/10/11 01:56:38 +0000'), 1349920598)
     self.assertEqual(unified_timestamp('1968 12 10'), -33436800)
     self.assertEqual(unified_timestamp('1968-12-10'), -33436800)
     self.assertEqual(unified_timestamp('28/01/2014 21:00:00 +0100'), 1390939200)
     self.assertEqual(
         unified_timestamp('11/26/2014 11:30:00 AM PST', day_first=False),
         1417001400)
     self.assertEqual(
         unified_timestamp('2/2/2015 6:47:40 PM', day_first=False),
         1422902860)
     self.assertEqual(unified_timestamp('Feb 14th 2016 5:45PM'), 1455471900)
     self.assertEqual(unified_timestamp('25-09-2014'), 1411603200)
     self.assertEqual(unified_timestamp('27.02.2016 17:30'), 1456594200)
     self.assertEqual(unified_timestamp('UNKNOWN DATE FORMAT'), None)
Пример #6
0
 def test_unified_timestamps5(self):
     self.assertEqual(unified_timestamp('1973 10 11'), 119145600)
     self.assertEqual(unified_timestamp('Feb 14, 2011'), 1297641600)
     self.assertEqual(unified_timestamp('September 21, 2010'), 1285027200)
Пример #7
0
 def test_unified_timestamps4(self):
     self.assertEqual(
         unified_timestamp('2018-03-14T08:32:43.1493874+00:00'), 1521016363)
     self.assertEqual(unified_timestamp('1973-10-11'), 119145600)
     self.assertEqual(unified_timestamp('2018-03-30T17:52:41Q'), 1522432361)
     self.assertEqual(unified_timestamp('25-09-2014'), 1411603200)
Пример #8
0
 def test_unified_timestamps3(self):
     self.assertEqual(unified_timestamp('UNKNOWN DATE FORMAT'), None)
Пример #9
0
 def test_unified_timestamps(self):
     self.assertEqual(unified_timestamp("December 21, 2010"), 1292889600)
     self.assertEqual(unified_timestamp("8/7/2009"), 1247011200)
     self.assertEqual(unified_timestamp("Dec 14, 2012"), 1355443200)
     self.assertEqual(unified_timestamp("2012/10/11 01:56:38 +0000"), 1349920598)
     self.assertEqual(unified_timestamp("1968 12 10"), -33436800)
     self.assertEqual(unified_timestamp("1968-12-10"), -33436800)
     self.assertEqual(unified_timestamp("28/01/2014 21:00:00 +0100"), 1390939200)
     self.assertEqual(unified_timestamp("11/26/2014 11:30:00 AM PST", day_first=False), 1417001400)
     self.assertEqual(unified_timestamp("2/2/2015 6:47:40 PM", day_first=False), 1422902860)
     self.assertEqual(unified_timestamp("Feb 14th 2016 5:45PM"), 1455471900)
     self.assertEqual(unified_timestamp("25-09-2014"), 1411603200)
     self.assertEqual(unified_timestamp("27.02.2016 17:30"), 1456594200)
     self.assertEqual(unified_timestamp("UNKNOWN DATE FORMAT"), None)
     self.assertEqual(unified_timestamp("May 16, 2016 11:15 PM"), 1463440500)