Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def setUp(self):
self.cal = pdt.Calendar()
(self.yr, self.mth, self.dy, self.hr,
self.mn, self.sec, self.wd, self.yd, self.isdst) = time.localtime()
def setUp(self):
locale = 'fr_FR'
self.ptc = pdt.Constants(locale, usePyICU=False)
self.cal = pdt.Calendar(self.ptc)
(self.yr, self.mth, self.dy, self.hr,
self.mn, self.sec, self.wd, self.yd, self.isdst) = time.localtime()
if self.ptc.localeID != locale:
raise unittest.SkipTest(
'Locale not set to fr_FR - check if PyICU is installed')
def setUp(self):
self.ptc = pdt.Constants('fr_FR', usePyICU=True)
self.cal = pdt.Calendar(self.ptc)
(self.yr, self.mth, self.dy, self.hr,
self.mn, self.sec, self.wd, self.yd, self.isdst) = time.localtime()
if self.ptc.localeID != 'fr_FR':
raise unittest.SkipTest(
'Locale not set to fr_FR - check if PyICU is installed')
def testSources(self):
self.assertEqual(self.cal.parse('afternoon 5pm')[1],
pdtContext(pdtContext.ACU_HALFDAY |
pdtContext.ACU_HOUR))
self.assertEqual(self.cal.parse('morning')[1],
pdtContext(pdtContext.ACU_HALFDAY))
self.assertEqual(self.cal.parse('night', version=1)[1], 2)
def testContext(self):
self.assertEqual(self.cal.parse('5 min from now')[1],
pdtContext(pdtContext.ACU_MIN | pdtContext.ACU_NOW))
self.assertEqual(self.cal.parse('5 min from now',
version=pdt.VERSION_FLAG_STYLE)[1], 2)
self.assertEqual(self.cal.parse('7/11/2015')[1],
pdtContext(pdtContext.ACU_YEAR |
pdtContext.ACU_MONTH | pdtContext.ACU_DAY))
self.assertEqual(self.cal.parse('7/11/2015',
version=pdt.VERSION_FLAG_STYLE)[1], 1)
self.assertEqual(self.cal.parse('14/32/2015')[1],
pdtContext(0))
self.assertEqual(self.cal.parse('25:23')[1],
pdtContext())
def testContext(self):
self.assertEqual(self.cal.parse('5 min from now')[1],
pdtContext(pdtContext.ACU_MIN | pdtContext.ACU_NOW))
self.assertEqual(self.cal.parse('5 min from now',
version=pdt.VERSION_FLAG_STYLE)[1], 2)
self.assertEqual(self.cal.parse('7/11/2015')[1],
pdtContext(pdtContext.ACU_YEAR |
pdtContext.ACU_MONTH | pdtContext.ACU_DAY))
self.assertEqual(self.cal.parse('7/11/2015',
version=pdt.VERSION_FLAG_STYLE)[1], 1)
self.assertEqual(self.cal.parse('14/32/2015')[1],
pdtContext(0))
self.assertEqual(self.cal.parse('25:23')[1],
pdtContext())
def testSources(self):
self.assertEqual(self.cal.parse('afternoon 5pm')[1],
pdtContext(pdtContext.ACU_HALFDAY |
pdtContext.ACU_HOUR))
self.assertEqual(self.cal.parse('morning')[1],
pdtContext(pdtContext.ACU_HALFDAY))
self.assertEqual(self.cal.parse('night', version=1)[1], 2)
def testContext(self):
self.assertEqual(self.cal.parse('5 min from now')[1],
pdtContext(pdtContext.ACU_MIN | pdtContext.ACU_NOW))
self.assertEqual(self.cal.parse('5 min from now',
version=pdt.VERSION_FLAG_STYLE)[1], 2)
self.assertEqual(self.cal.parse('7/11/2015')[1],
pdtContext(pdtContext.ACU_YEAR |
pdtContext.ACU_MONTH | pdtContext.ACU_DAY))
self.assertEqual(self.cal.parse('7/11/2015',
version=pdt.VERSION_FLAG_STYLE)[1], 1)
self.assertEqual(self.cal.parse('14/32/2015')[1],
pdtContext(0))
self.assertEqual(self.cal.parse('25:23')[1],
pdtContext())
def setUp(self):
self.cal = pdt.Calendar(version=pdt.VERSION_CONTEXT_STYLE)
(self.yr, self.mth, self.dy, self.hr, self.mn,
self.sec, self.wd, self.yd, self.isdst) = time.localtime()
def setUp(self):
self.cal = pdt.Calendar(version=pdt.VERSION_CONTEXT_STYLE)
self.source = (2017, 1, 1, 7, 1, 2, 6, 1, 1)