Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
input = '2016-5-27 21:22:2'
self.assertEqual(parser.parse(input), date)
input = '2016/05/27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016/5/27 21:22:02'
self.assertEqual(parser.parse(input), date)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
input = '2016/05/27'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
today.year, today.month, today.day, 12, 12, 12)
input = '12:12:12'
self.assertEqual(parser.parse(input), date)
# date
input = dateimport(2016, 5, 27)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
self.assertEqual(parser.parse(input), date)
# time
input = '2016/05/27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016/5/27 21:22:02'
self.assertEqual(parser.parse(input), date)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
input = '2016/05/27'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
today.year, today.month, today.day, 12, 12, 12)
input = '12:12:12'
self.assertEqual(parser.parse(input), date)
# date
input = dateimport(2016, 5, 27)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
self.assertEqual(parser.parse(input), date)
# time
today = dateimport.today()
input = time(21, 45, 27)
date = datetime.datetime(
# datetime string
input = '2016-05-27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27 21:22:2'
self.assertEqual(parser.parse(input), date)
input = '2016/05/27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016/5/27 21:22:02'
self.assertEqual(parser.parse(input), date)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
input = '2016/05/27'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
today.year, today.month, today.day, 12, 12, 12)
input = '12:12:12'
self.assertEqual(parser.parse(input), date)
# date
input = dateimport(2016, 5, 27)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
input = '2016/05/27'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
today.year, today.month, today.day, 12, 12, 12)
input = '12:12:12'
self.assertEqual(parser.parse(input), date)
# date
input = dateimport(2016, 5, 27)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
self.assertEqual(parser.parse(input), date)
# time
today = dateimport.today()
input = time(21, 45, 27)
date = datetime.datetime(
today.year, today.month, today.day, 21, 45, 27)
self.assertEqual(parser.parse(input), date)
# datetime
input = datetime.datetime(2016, 5, 27, 21, 45, 27)
date = datetime.datetime(2016, 5, 27, 21, 45, 27)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
today.year, today.month, today.day, 12, 12, 12)
input = '12:12:12'
self.assertEqual(parser.parse(input), date)
# date
input = dateimport(2016, 5, 27)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
self.assertEqual(parser.parse(input), date)
# time
today = dateimport.today()
input = time(21, 45, 27)
date = datetime.datetime(
today.year, today.month, today.day, 21, 45, 27)
self.assertEqual(parser.parse(input), date)
# datetime
input = datetime.datetime(2016, 5, 27, 21, 45, 27)
date = datetime.datetime(2016, 5, 27, 21, 45, 27)
self.assertEqual(parser.parse(input), date)
# None
input = '2016-05-27 23.23:21'
self.assertEqual(parser.parse(input), None)
def test_timeago_parse_input(self):
date = datetime.datetime(2016, 5, 27, 21, 22, 2)
# datetime string
input = '2016-05-27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27 21:22:2'
self.assertEqual(parser.parse(input), date)
input = '2016/05/27 21:22:02'
self.assertEqual(parser.parse(input), date)
input = '2016/5/27 21:22:02'
self.assertEqual(parser.parse(input), date)
date = datetime.datetime(2016, 5, 27, 0, 0, 0)
input = '2016/05/27'
self.assertEqual(parser.parse(input), date)
input = '2016-5-27'
self.assertEqual(parser.parse(input), date)
input = '2016-05-27'
self.assertEqual(parser.parse(input), date)
today = dateimport.today()
date = datetime.datetime(
date = datetime.datetime(
today.year, today.month, today.day, 21, 45, 27)
self.assertEqual(parser.parse(input), date)
# datetime
input = datetime.datetime(2016, 5, 27, 21, 45, 27)
date = datetime.datetime(2016, 5, 27, 21, 45, 27)
self.assertEqual(parser.parse(input), date)
# None
input = '2016-05-27 23.23:21'
self.assertEqual(parser.parse(input), None)
# None
input = '2016-05-27 23:23:21'
self.assertEqual(parser.parse(input), None)