当前位置: 首页>>代码示例>>Python>>正文


Python cookielib.time2isoz方法代码示例

本文整理汇总了Python中cookielib.time2isoz方法的典型用法代码示例。如果您正苦于以下问题:Python cookielib.time2isoz方法的具体用法?Python cookielib.time2isoz怎么用?Python cookielib.time2isoz使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cookielib的用法示例。


在下文中一共展示了cookielib.time2isoz方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_time2isoz

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_time2isoz(self):
        from cookielib import time2isoz

        base = 1019227000
        day = 24*3600
        self.assertEqual(time2isoz(base), "2002-04-19 14:36:40Z")
        self.assertEqual(time2isoz(base+day), "2002-04-20 14:36:40Z")
        self.assertEqual(time2isoz(base+2*day), "2002-04-21 14:36:40Z")
        self.assertEqual(time2isoz(base+3*day), "2002-04-22 14:36:40Z")

        az = time2isoz()
        bz = time2isoz(500000)
        for text in (az, bz):
            self.assertRegexpMatches(text,
                                     r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$",
                                     "bad time2isoz format: %s %s" % (az, bz)) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:18,代码来源:test_cookielib.py

示例2: test_time2isoz

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_time2isoz(self):
        base = 1019227000
        day = 24*3600
        self.assertEqual(time2isoz(base), "2002-04-19 14:36:40Z")
        self.assertEqual(time2isoz(base+day), "2002-04-20 14:36:40Z")
        self.assertEqual(time2isoz(base+2*day), "2002-04-21 14:36:40Z")
        self.assertEqual(time2isoz(base+3*day), "2002-04-22 14:36:40Z")

        az = time2isoz()
        bz = time2isoz(500000)
        for text in (az, bz):
            self.assertRegexpMatches(text,
                                     r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$",
                                     "bad time2isoz format: %s %s" % (az, bz)) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:16,代码来源:test_cookielib.py

示例3: test_http2time_formats

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_http2time_formats(self):


        # test http2time for supported dates.  Test cases with 2 digit year
        # will probably break in year 2044.
        tests = [
         'Thu, 03 Feb 1994 00:00:00 GMT',  # proposed new HTTP format
         'Thursday, 03-Feb-94 00:00:00 GMT',  # old rfc850 HTTP format
         'Thursday, 03-Feb-1994 00:00:00 GMT',  # broken rfc850 HTTP format

         '03 Feb 1994 00:00:00 GMT',  # HTTP format (no weekday)
         '03-Feb-94 00:00:00 GMT',  # old rfc850 (no weekday)
         '03-Feb-1994 00:00:00 GMT',  # broken rfc850 (no weekday)
         '03-Feb-1994 00:00 GMT',  # broken rfc850 (no weekday, no seconds)
         '03-Feb-1994 00:00',  # broken rfc850 (no weekday, no seconds, no tz)

         '03-Feb-94',  # old rfc850 HTTP format (no weekday, no time)
         '03-Feb-1994',  # broken rfc850 HTTP format (no weekday, no time)
         '03 Feb 1994',  # proposed new HTTP format (no weekday, no time)

         # A few tests with extra space at various places
         '  03   Feb   1994  0:00  ',
         '  03-Feb-1994  ',
        ]

        test_t = 760233600  # assume broken POSIX counting of seconds
        result = time2isoz(test_t)
        expected = "1994-02-03 00:00:00Z"
        self.assertEqual(result, expected,
                         "%s  =>  '%s' (%s)" % (test_t, result, expected))

        for s in tests:
            self.assertEqual(http2time(s), test_t, s)
            self.assertEqual(http2time(s.lower()), test_t, s.lower())
            self.assertEqual(http2time(s.upper()), test_t, s.upper()) 
开发者ID:IronLanguages,项目名称:ironpython2,代码行数:37,代码来源:test_cookielib.py

示例4: test_time2isoz

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_time2isoz(self):
        from cookielib import time2isoz

        base = 1019227000
        day = 24*3600
        self.assertEqual(time2isoz(base), "2002-04-19 14:36:40Z")
        self.assertEqual(time2isoz(base+day), "2002-04-20 14:36:40Z")
        self.assertEqual(time2isoz(base+2*day), "2002-04-21 14:36:40Z")
        self.assertEqual(time2isoz(base+3*day), "2002-04-22 14:36:40Z")

        az = time2isoz()
        bz = time2isoz(500000)
        for text in (az, bz):
            self.assertTrue(re.search(r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$", text),
                         "bad time2isoz format: %s %s" % (az, bz)) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:17,代码来源:test_cookielib.py

示例5: test_http2time_formats

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_http2time_formats(self):
        from cookielib import http2time, time2isoz

        # test http2time for supported dates.  Test cases with 2 digit year
        # will probably break in year 2044.
        tests = [
         'Thu, 03 Feb 1994 00:00:00 GMT',  # proposed new HTTP format
         'Thursday, 03-Feb-94 00:00:00 GMT',  # old rfc850 HTTP format
         'Thursday, 03-Feb-1994 00:00:00 GMT',  # broken rfc850 HTTP format

         '03 Feb 1994 00:00:00 GMT',  # HTTP format (no weekday)
         '03-Feb-94 00:00:00 GMT',  # old rfc850 (no weekday)
         '03-Feb-1994 00:00:00 GMT',  # broken rfc850 (no weekday)
         '03-Feb-1994 00:00 GMT',  # broken rfc850 (no weekday, no seconds)
         '03-Feb-1994 00:00',  # broken rfc850 (no weekday, no seconds, no tz)

         '03-Feb-94',  # old rfc850 HTTP format (no weekday, no time)
         '03-Feb-1994',  # broken rfc850 HTTP format (no weekday, no time)
         '03 Feb 1994',  # proposed new HTTP format (no weekday, no time)

         # A few tests with extra space at various places
         '  03   Feb   1994  0:00  ',
         '  03-Feb-1994  ',
        ]

        test_t = 760233600  # assume broken POSIX counting of seconds
        result = time2isoz(test_t)
        expected = "1994-02-03 00:00:00Z"
        self.assertEqual(result, expected,
                         "%s  =>  '%s' (%s)" % (test_t, result, expected))

        for s in tests:
            t = http2time(s)
            t2 = http2time(s.lower())
            t3 = http2time(s.upper())

            self.assertTrue(t == t2 == t3 == test_t,
                         "'%s'  =>  %s, %s, %s (%s)" % (s, t, t2, t3, test_t)) 
开发者ID:dxwu,项目名称:BinderFilter,代码行数:40,代码来源:test_cookielib.py

示例6: test_http2time_formats

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_http2time_formats(self):
        from cookielib import http2time, time2isoz

        # test http2time for supported dates.  Test cases with 2 digit year
        # will probably break in year 2044.
        tests = [
         'Thu, 03 Feb 1994 00:00:00 GMT',  # proposed new HTTP format
         'Thursday, 03-Feb-94 00:00:00 GMT',  # old rfc850 HTTP format
         'Thursday, 03-Feb-1994 00:00:00 GMT',  # broken rfc850 HTTP format

         '03 Feb 1994 00:00:00 GMT',  # HTTP format (no weekday)
         '03-Feb-94 00:00:00 GMT',  # old rfc850 (no weekday)
         '03-Feb-1994 00:00:00 GMT',  # broken rfc850 (no weekday)
         '03-Feb-1994 00:00 GMT',  # broken rfc850 (no weekday, no seconds)
         '03-Feb-1994 00:00',  # broken rfc850 (no weekday, no seconds, no tz)

         '03-Feb-94',  # old rfc850 HTTP format (no weekday, no time)
         '03-Feb-1994',  # broken rfc850 HTTP format (no weekday, no time)
         '03 Feb 1994',  # proposed new HTTP format (no weekday, no time)

         # A few tests with extra space at various places
         '  03   Feb   1994  0:00  ',
         '  03-Feb-1994  ',
        ]

        test_t = 760233600  # assume broken POSIX counting of seconds
        result = time2isoz(test_t)
        expected = "1994-02-03 00:00:00Z"
        self.assertEqual(result, expected,
                         "%s  =>  '%s' (%s)" % (test_t, result, expected))

        for s in tests:
            self.assertEqual(http2time(s), test_t, s)
            self.assertEqual(http2time(s.lower()), test_t, s.lower())
            self.assertEqual(http2time(s.upper()), test_t, s.upper()) 
开发者ID:aliyun,项目名称:oss-ftp,代码行数:37,代码来源:test_cookielib.py

示例7: test_time2isoz

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_time2isoz(self):
        from cookielib import time2isoz

        base = 1019227000
        day = 24*3600
        self.assertEquals(time2isoz(base), "2002-04-19 14:36:40Z")
        self.assertEquals(time2isoz(base+day), "2002-04-20 14:36:40Z")
        self.assertEquals(time2isoz(base+2*day), "2002-04-21 14:36:40Z")
        self.assertEquals(time2isoz(base+3*day), "2002-04-22 14:36:40Z")

        az = time2isoz()
        bz = time2isoz(500000)
        for text in (az, bz):
            self.assert_(re.search(r"^\d{4}-\d\d-\d\d \d\d:\d\d:\d\dZ$", text),
                         "bad time2isoz format: %s %s" % (az, bz)) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:17,代码来源:test_cookielib.py

示例8: test_http2time_formats

# 需要导入模块: import cookielib [as 别名]
# 或者: from cookielib import time2isoz [as 别名]
def test_http2time_formats(self):
        from cookielib import http2time, time2isoz

        # test http2time for supported dates.  Test cases with 2 digit year
        # will probably break in year 2044.
        tests = [
         'Thu, 03 Feb 1994 00:00:00 GMT',  # proposed new HTTP format
         'Thursday, 03-Feb-94 00:00:00 GMT',  # old rfc850 HTTP format
         'Thursday, 03-Feb-1994 00:00:00 GMT',  # broken rfc850 HTTP format

         '03 Feb 1994 00:00:00 GMT',  # HTTP format (no weekday)
         '03-Feb-94 00:00:00 GMT',  # old rfc850 (no weekday)
         '03-Feb-1994 00:00:00 GMT',  # broken rfc850 (no weekday)
         '03-Feb-1994 00:00 GMT',  # broken rfc850 (no weekday, no seconds)
         '03-Feb-1994 00:00',  # broken rfc850 (no weekday, no seconds, no tz)

         '03-Feb-94',  # old rfc850 HTTP format (no weekday, no time)
         '03-Feb-1994',  # broken rfc850 HTTP format (no weekday, no time)
         '03 Feb 1994',  # proposed new HTTP format (no weekday, no time)

         # A few tests with extra space at various places
         '  03   Feb   1994  0:00  ',
         '  03-Feb-1994  ',
        ]

        test_t = 760233600  # assume broken POSIX counting of seconds
        result = time2isoz(test_t)
        expected = "1994-02-03 00:00:00Z"
        self.assertEquals(result, expected,
                          "%s  =>  '%s' (%s)" % (test_t, result, expected))

        for s in tests:
            t = http2time(s)
            t2 = http2time(s.lower())
            t3 = http2time(s.upper())

            self.assert_(t == t2 == t3 == test_t,
                         "'%s'  =>  %s, %s, %s (%s)" % (s, t, t2, t3, test_t)) 
开发者ID:ofermend,项目名称:medicare-demo,代码行数:40,代码来源:test_cookielib.py


注:本文中的cookielib.time2isoz方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。