Python email.Utils.parsedate() Examples

The following are 30 code examples of email.Utils.parsedate(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module email.Utils , or try the search function .
Example #1
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #2
Source File: test_email.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #3
Source File: test_email.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #4
Source File: test_email.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #5
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate(self):
        now = time.time()
        self.assertEqual(Utils.parsedate(Utils.formatdate(now))[:6],
                         time.gmtime(now)[:6]) 
Example #6
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #7
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #8
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #9
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #10
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #11
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #12
Source File: test_email.py    From medicare-demo with Apache License 2.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #13
Source File: test_email.py    From CTFCrackTools-V2 with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #14
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate(self):
        now = time.time()
        self.assertEqual(Utils.parsedate(Utils.formatdate(now))[:6],
                         time.gmtime(now)[:6]) 
Example #15
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #16
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #17
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #18
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #19
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #20
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #21
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #22
Source File: test_email.py    From CTFCrackTools with GNU General Public License v3.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #23
Source File: test_email.py    From oss-ftp with MIT License 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #24
Source File: test_email.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #25
Source File: test_email.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None) 
Example #26
Source File: test_email.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_parsedate_compact(self):
        # The FWS after the comma is optional
        self.assertEqual(Utils.parsedate('Wed,3 Apr 2002 14:58:26 +0800'),
                         Utils.parsedate('Wed, 3 Apr 2002 14:58:26 +0800')) 
Example #27
Source File: test_email.py    From ironpython2 with Apache License 2.0 5 votes vote down vote up
def test_parsedate_acceptable_to_time_functions(self):
        eq = self.assertEqual
        timetup = Utils.parsedate('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup)), 2003)
        timetup = Utils.parsedate_tz('5 Feb 2003 13:47:26 -0800')
        t = int(time.mktime(timetup[:9]))
        eq(time.localtime(t)[:6], timetup[:6])
        eq(int(time.strftime('%Y', timetup[:9])), 2003) 
Example #28
Source File: test_email.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_formatdate(self):
        now = time.time()
        self.assertEqual(Utils.parsedate(Utils.formatdate(now))[:6],
                         time.gmtime(now)[:6]) 
Example #29
Source File: test_email.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_formatdate_localtime(self):
        now = time.time()
        self.assertEqual(
            Utils.parsedate(Utils.formatdate(now, localtime=True))[:6],
            time.localtime(now)[:6]) 
Example #30
Source File: test_email.py    From BinderFilter with MIT License 5 votes vote down vote up
def test_parsedate_none(self):
        self.assertEqual(Utils.parsedate(''), None)