Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
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())
else:
v2 = int(s.strip())
v = [v1, v2, v3]
d = {'m': mth, 'd': dy, 'y': yr}
# yyyy/mm/dd format
dp_order = self.ptc.dp_order if v1 <= 31 else ['y', 'm', 'd']
for i in range(0, 3):
n = v[i]
c = dp_order[i]
if n >= 0:
d[c] = n
accuracy.append({'m': pdtContext.ACU_MONTH,
'd': pdtContext.ACU_DAY,
'y': pdtContext.ACU_YEAR}[c])
# if the year is not specified and the date has already
# passed, increment the year
if v3 == -1 and ((mth > d['m']) or (mth == d['m'] and dy > d['d'])):
yr = d['y'] + self.ptc.YearParseStyle
else:
yr = d['y']
mth = d['m']
dy = d['d']
# birthday epoch constraint
if yr < self.ptc.BirthdayEpoch:
yr += 2000
elif yr < 100: