def test_parse_date_exception(self): date = 'i am no date' textinfo = {six.b('TextInfoItem9'): six.b(date)} result = parse_date(textinfo) self.assertIsNone(result)
def _parse_date(self): try: return parse_date(self.image_text_info[six.b('SLxImageTextInfo')]) except KeyError: return None
def test_parse_date_12(self): date_format = "%m/%d/%Y %I:%M:%S %p" date = '02/13/2016 11:43:37 PM' textinfo = {six.b('TextInfoItem9'): six.b(date)} result = parse_date(textinfo) self.assertEqual(result.strftime(date_format), date)