本文整理汇总了Python中twistedcaldav.timezones.TimezoneCache.clear方法的典型用法代码示例。如果您正苦于以下问题:Python TimezoneCache.clear方法的具体用法?Python TimezoneCache.clear怎么用?Python TimezoneCache.clear使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twistedcaldav.timezones.TimezoneCache
的用法示例。
在下文中一共展示了TimezoneCache.clear方法的13个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_copyPackage_Concurrency
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_copyPackage_Concurrency(self):
"""
Test that concurrent copying of the tz package works.
"""
self.patch(config, "UsePackageTimezones", False)
TimezoneCache.clear()
ex = [None, None]
def _try(n):
try:
TimezoneCache.create()
except:
f = Failure()
ex[n] = str(f)
t1 = threading.Thread(target=_try, args=(0,))
t2 = threading.Thread(target=_try, args=(1,))
t1.start()
t2.start()
t1.join()
t2.join()
self.assertTrue(ex[0] is None, msg=ex[0])
self.assertTrue(ex[1] is None, msg=ex[1])
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo")))
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "America", "New_York.ics")))
示例2: test_truncatedDec
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedDec(self):
"""
Properties in components
"""
TimezoneCache.create("")
TimezoneCache.clear()
self.doTest(
"TruncatedDec10.ics",
PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
)
示例3: test_truncatedDec
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedDec(self):
"""
Custom VTZ valid from 2007. Daylight 2007 OK.
"""
TimezoneCache.create(empty=True)
TimezoneCache.clear()
self.doTest(
"TruncatedDec10.ics",
PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True))
)
示例4: test_truncatedApr
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedApr(self):
"""
Custom VTZ with truncated standard time - 2006. Daylight 2007 OK.
"""
TimezoneCache.create(empty=True)
TimezoneCache.clear()
self.doTest(
"TruncatedApr01.ics",
PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
)
示例5: test_truncatedApr
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedApr(self):
"""
Properties in components
"""
TimezoneCache.create("")
TimezoneCache.clear()
self.doTest(
"TruncatedApr01.ics",
PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True))
)
示例6: test_copyPackage_missingVersion
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_copyPackage_missingVersion(self):
"""
Test that tz data is updated if the version is missing.
"""
self.patch(config, "UsePackageTimezones", False)
TimezoneCache.clear()
TimezoneCache.create()
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo")))
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))
os.remove(os.path.join(config.DataRoot, "zoneinfo", "version.txt"))
self.assertFalse(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))
TimezoneCache.create()
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "version.txt")))
示例7: test_truncatedDecThenApr
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedDecThenApr(self):
"""
Custom VTZ valid from 2007 loaded first. Daylight 2007 OK.
"""
TimezoneCache.create(empty=True)
TimezoneCache.clear()
self.doTest(
"TruncatedDec10.ics",
DateTime(2007, 12, 10, 17, 0, 0, Timezone(utc=True)),
DateTime(2007, 12, 10, 18, 0, 0, Timezone(utc=True))
)
self.doTest(
"TruncatedApr01.ics",
DateTime(2007, 04, 01, 16, 0, 0, Timezone(utc=True)),
DateTime(2007, 04, 01, 17, 0, 0, Timezone(utc=True))
)
示例8: test_truncatedAprThenDecFail
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedAprThenDecFail(self):
"""
Custom VTZ with truncated standard time - 2006 loaded first. Daylight 2007 OK, standard 2007 wrong.
"""
TimezoneCache.create(empty=True)
TimezoneCache.clear()
self.doTest(
"TruncatedApr01.ics",
PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
)
self.doTest(
"TruncatedDec10.ics",
PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
testEqual=False
)
示例9: test_truncatedAprThenDecFail
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_truncatedAprThenDecFail(self):
"""
Properties in components
"""
TimezoneCache.create("")
TimezoneCache.clear()
self.doTest(
"TruncatedApr01.ics",
PyCalendarDateTime(2007, 04, 01, 16, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 04, 01, 17, 0, 0, PyCalendarTimezone(utc=True)),
)
self.doTest(
"TruncatedDec10.ics",
PyCalendarDateTime(2007, 12, 10, 17, 0, 0, PyCalendarTimezone(utc=True)),
PyCalendarDateTime(2007, 12, 10, 18, 0, 0, PyCalendarTimezone(utc=True)),
testEqual=False
)
示例10: test_copyPackage
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def test_copyPackage(self):
"""
Test that copying of the tz package works.
"""
self.patch(config, "UsePackageTimezones", True)
TimezoneCache.clear()
TimezoneCache.create()
self.assertFalse(os.path.exists(os.path.join(config.DataRoot, "zoneinfo")))
self.assertFalse(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "America", "New_York.ics")))
pkg_tz = readTZ("America/New_York")
self.patch(config, "UsePackageTimezones", False)
TimezoneCache.clear()
TimezoneCache.create()
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo")))
self.assertTrue(os.path.exists(os.path.join(config.DataRoot, "zoneinfo", "America", "New_York.ics")))
copy_tz = readTZ("America/New_York")
self.assertEqual(str(pkg_tz), str(copy_tz))
示例11: tearDown
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def tearDown(self):
TimezoneCache.clear()
TimezoneCache.create()
示例12: setUp
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def setUp(self):
super(TimezonePackageTest, self).setUp()
TimezoneCache.clear()
TimezoneCache.create()
示例13: setUp
# 需要导入模块: from twistedcaldav.timezones import TimezoneCache [as 别名]
# 或者: from twistedcaldav.timezones.TimezoneCache import clear [as 别名]
def setUp(self):
TimezoneCache.clear()
TimezoneCache.create()