當前位置: 首頁>>代碼示例>>Python>>正文


Python tzwin.tzwin方法代碼示例

本文整理匯總了Python中dateutil.tzwin.tzwin方法的典型用法代碼示例。如果您正苦於以下問題:Python tzwin.tzwin方法的具體用法?Python tzwin.tzwin怎麽用?Python tzwin.tzwin使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在dateutil.tzwin的用法示例。


在下文中一共展示了tzwin.tzwin方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: testTzAll

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzAll(self):
        from dateutil.tz import tzutc
        from dateutil.tz import tzoffset
        from dateutil.tz import tzlocal
        from dateutil.tz import tzfile
        from dateutil.tz import tzrange
        from dateutil.tz import tzstr
        from dateutil.tz import tzical
        from dateutil.tz import gettz
        from dateutil.tz import tzwin
        from dateutil.tz import tzwinlocal
        from dateutil.tz import UTC
        from dateutil.tz import datetime_ambiguous
        from dateutil.tz import datetime_exists
        from dateutil.tz import resolve_imaginary

        tz_all = ["tzutc", "tzoffset", "tzlocal", "tzfile", "tzrange",
                  "tzstr", "tzical", "gettz", "datetime_ambiguous",
                  "datetime_exists", "resolve_imaginary", "UTC"]

        tz_all += ["tzwin", "tzwinlocal"] if sys.platform.startswith("win") else []
        lvars = locals()

        for var in tz_all:
            self.assertIsNot(lvars[var], None) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:27,代碼來源:test_imports.py

示例2: setUp

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def setUp(self):
        self.tzclass = tzwin.tzwin 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:4,代碼來源:test_tz.py

示例3: testTzResLoadName

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzResLoadName(self):
        # This may not work right on non-US locales.
        tzr = tzwin.tzres()
        self.assertEqual(tzr.load_name(112), "Eastern Standard Time") 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:6,代碼來源:test_tz.py

示例4: testTzResNameFromString

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzResNameFromString(self):
        tzr = tzwin.tzres()
        self.assertEqual(tzr.name_from_string('@tzres.dll,-221'),
                         'Alaskan Daylight Time')

        self.assertEqual(tzr.name_from_string('Samoa Daylight Time'),
                         'Samoa Daylight Time')

        with self.assertRaises(ValueError):
            tzr.name_from_string('@tzres.dll,100') 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:12,代碼來源:test_tz.py

示例5: testIsdstZoneWithNoDaylightSaving

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testIsdstZoneWithNoDaylightSaving(self):
        tz = tzwin.tzwin("UTC")
        dt = parse("2013-03-06 19:08:15")
        self.assertFalse(tz._isdst(dt)) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:6,代碼來源:test_tz.py

示例6: testOffset

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testOffset(self):
        tz = tzwin.tzwin("Cape Verde Standard Time")
        self.assertEqual(tz.utcoffset(datetime(1995, 5, 21, 12, 9, 13)),
                         timedelta(-1, 82800)) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:6,代碼來源:test_tz.py

示例7: testTzwinRepr

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzwinRepr(self):
        tw = tz.tzwin('Yakutsk Standard Time')
        self.assertEqual(repr(tw), 'tzwin(' +
                                   repr('Yakutsk Standard Time') + ')') 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:6,代碼來源:test_tz.py

示例8: testTzWinEquality

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzWinEquality(self):
        # https://github.com/dateutil/dateutil/issues/151
        tzwin_names = ('Eastern Standard Time',
                       'West Pacific Standard Time',
                       'Yakutsk Standard Time',
                       'Iran Standard Time',
                       'UTC')

        for tzwin_name in tzwin_names:
            # Get two different instances to compare
            tw1 = tz.tzwin(tzwin_name)
            tw2 = tz.tzwin(tzwin_name)

            self.assertEqual(tw1, tw2) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:16,代碼來源:test_tz.py

示例9: testTzWinInequality

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzWinInequality(self):
        # https://github.com/dateutil/dateutil/issues/151
        # Note these last two currently differ only in their name.
        tzwin_names = (('Eastern Standard Time', 'Yakutsk Standard Time'),
                       ('Greenwich Standard Time', 'GMT Standard Time'),
                       ('GMT Standard Time', 'UTC'),
                       ('E. South America Standard Time',
                        'Argentina Standard Time'))

        for tzwn1, tzwn2 in tzwin_names:
            # Get two different instances to compare
            tw1 = tz.tzwin(tzwn1)
            tw2 = tz.tzwin(tzwn2)

            self.assertNotEqual(tw1, tw2) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:17,代碼來源:test_tz.py

示例10: testTzWinEqualityInvalid

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzWinEqualityInvalid(self):
        # Compare to objects that do not implement comparison with this
        # (should default to False)
        UTC = tz.tzutc()
        EST = tz.tzwin('Eastern Standard Time')

        self.assertFalse(EST == UTC)
        self.assertFalse(EST == 1)
        self.assertFalse(UTC == EST)

        self.assertTrue(EST != UTC)
        self.assertTrue(EST != 1) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:14,代碼來源:test_tz.py

示例11: testTzWinInequalityUnsupported

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzWinInequalityUnsupported(self):
        # Compare it to an object that is promiscuous about equality, but for
        # which tzwin does not implement an equality operator.
        EST = tz.tzwin('Eastern Standard Time')
        self.assertTrue(EST == ComparesEqual)
        self.assertFalse(EST != ComparesEqual) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:8,代碼來源:test_tz.py

示例12: testTzwinTimeOnlyUTCOffset

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzwinTimeOnlyUTCOffset(self):
        # For zones with DST, .utcoffset() should return None
        tw_est = tz.tzwin('Eastern Standard Time')
        self.assertIs(dt_time(14, 10, tzinfo=tw_est).utcoffset(), None)

        # This zone has no DST, so .utcoffset() returns standard offset
        tw_sast = tz.tzwin('South Africa Standard Time')
        self.assertEqual(dt_time(14, 10, tzinfo=tw_sast).utcoffset(),
                         timedelta(hours=2)) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:11,代碼來源:test_tz.py

示例13: testTzwinTimeOnlyTZName

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzwinTimeOnlyTZName(self):
        # For zones with DST, the name defaults to standard time
        tw_est = tz.tzwin('Eastern Standard Time')
        self.assertEqual(dt_time(14, 10, tzinfo=tw_est).tzname(),
                         'Eastern Standard Time')

        # For zones with no DST, this should work normally.
        tw_sast = tz.tzwin('South Africa Standard Time')
        self.assertEqual(dt_time(14, 10, tzinfo=tw_sast).tzname(),
                         'South Africa Standard Time') 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:12,代碼來源:test_tz.py

示例14: testLocal

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testLocal(self):
        # Not sure how to pin a local time zone, so for now we're just going
        # to run this and make sure it doesn't raise an error
        # See Github Issue #135: https://github.com/dateutil/dateutil/issues/135
        datetime.now(tzwin.tzwinlocal()) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:7,代碼來源:test_tz.py

示例15: testTzwinLocalUTCOffset

# 需要導入模塊: from dateutil import tzwin [as 別名]
# 或者: from dateutil.tzwin import tzwin [as 別名]
def testTzwinLocalUTCOffset(self):
        with TZWinContext('Eastern Standard Time'):
            tzwl = tzwin.tzwinlocal()
            self.assertEqual(datetime(2014, 3, 11, tzinfo=tzwl).utcoffset(),
                             timedelta(hours=-4)) 
開發者ID:MediaBrowser,項目名稱:plugin.video.emby,代碼行數:7,代碼來源:test_tz.py


注:本文中的dateutil.tzwin.tzwin方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。