Example #1
0
 def testGeneral(self):
     dt = listparser._rfc822('Sun, 14 Jun 2009 11:47:32 GMT')
     self.assertEqual(dt.day, 14)
     self.assertEqual(dt.year, 2009)
     self.assertEqual(dt.hour, 11)
     self.assertEqual(dt.minute, 47)
     self.assertEqual(dt.second, 32)
Example #2
0
 def testMissingTimeAndTimezone(self):
     dt = listparser._rfc822('Sun, Dec 16 2012')
     self.assertEqual(dt.day, 16)
     self.assertEqual(dt.month, 12)
     self.assertEqual(dt.year, 2012)
     self.assertEqual(dt.hour, 0)
     self.assertEqual(dt.minute, 0)
     self.assertEqual(dt.second, 0)
Example #3
0
 def testSwappedMonthAndDay(self):
     dt = listparser._rfc822('Sun, Dec 16 2012 11:15:01 GMT')
     self.assertEqual(dt.day, 16)
     self.assertEqual(dt.month, 12)
     self.assertEqual(dt.year, 2012)
     self.assertEqual(dt.hour, 11)
     self.assertEqual(dt.minute, 15)
     self.assertEqual(dt.second, 1)
Example #4
0
 def testRangeYearLow(self):
     dt = listparser._rfc822('Sun, 01 Jan 0000 00:00:00 +9999')
     # This works only because 0 is interpreted as the year 2000
     self.assert_(isinstance(dt, datetime.datetime))
Example #5
0
 def fn(self):
     dt = listparser._rfc822(s)
     self.assert_(dt is None)
Example #6
0
 def fn(self):
     dt = listparser._rfc822(s)
     self.assertEqual(dt.year, y)
Example #7
0
 def fn(self):
     dt = listparser._rfc822(s)
     self.assertEqual(dt.hour, h)
     self.assertEqual(dt.minute, m)
     self.assertEqual(dt.day, d)
Example #8
0
 def fn(self):
     dt = listparser._rfc822(s)
     self.assertEqual(dt.month, m)
Example #9
0
 def testInvalidDateTime(self):
     dt = listparser._rfc822('Earlier today...wait, no, yesterday')
     self.assert_(dt is None)
Example #10
0
 def testSecondMissing(self):
     dt = listparser._rfc822('Sun, 21 Jun 2009 12:00 GMT')
     self.assertEqual(dt.second, 0)
Example #11
0
 def testSingleDigitDay(self):
     dt = listparser._rfc822('Thu,  5 Apr 2012 10:00:00 GMT')
     self.assertEqual(dt.day, 5)
Example #12
0
    if 'No-Eval' in info:
        # No-Eval files are requested over HTTP (generally representing
        # an HTTP redirection destination) and contain no testcases.
        # They probably have a Requests directive, though, which is why
        # the `continue` here appears after numtests is incremented.
        continue
    if not description:
        raise ValueError("Description not found in test %s" % testfile)
    if not evals:
        raise ValueError("Eval not found in test %s" % testfile)
    if modified:
        testcase = make_testcase(evals, testfile, etag, modified)
        testcase.__doc__ = '%s: %s [string]' % (testfile, description)
        setattr(TestCases, 'test_%s_1' % splitext(testfile)[0], testcase)
        testcase = make_testcase(evals, testfile, etag,
                                 listparser._rfc822(modified))
        testcase.__doc__ = '%s: %s [datetime]' % (testfile, description)
        setattr(TestCases, 'test_%s_2' % splitext(testfile)[0], testcase)
    else:
        testcase = make_testcase(evals, testfile, etag, modified)
        testcase.__doc__ = '%s: %s' % (testfile, description)
        setattr(TestCases, 'test_%s' % splitext(testfile)[0], testcase)

server = ServerThread(numtests)
server.setDaemon(True)
server.start()

# Wait for the server thread to signal that it's ready
server.ready.wait()

testsuite = unittest.TestSuite()
Example #13
0
 def fn(self):
     dt = listparser._rfc822(s)
     self.assertEqual(dt, None)