def test_dni_old_first_back_in_same_level(self): keywords = dict(self.keywords) keywords = {key:False for key, value in self.keywords.items()} keywords["idesp"] = True keywords['dni num'] = True keywords['domicilio / domicili'] = True keywords['lugar de nacimiento/ lloc de naixement'] = True keywords['equipo / equip'] = True parser = DNIScumParser(DNI_OLD_FIRST_BACK) result = parser.parse() ocrs = {'date_expires': u'210610', 'surnames': u'martinez gago', 'date_birth': u'690619', 'names': u'pepa esther', 'nat': u'esp', 'country': u'esp', 'dni': u'53686041w', 'sex': u'f'} self.assertResult(result, [date(year=1969, month=6, day=19), date(year=2021, month=6, day=10)], keywords, ocrs)
def test_dni_old_no_back(self): keywords = dict(self.keywords) keywords['equipo'] = False keywords['lugar de nacimiento'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False keywords['nombre'] = False keywords['apellidos'] = False keywords['hijo/a de'] = False keywords['num soport validez'] = False keywords['domicilio'] = False ocrs = {} parser = DNIScumParser(DNI_OLD_NO_BACK) result = parser.parse() self.assertResult(result, [date(year=2021, month=9, day=19)], keywords, ocrs)
def test_dni_old(self): keywords = dict(self.keywords) keywords['dni'] = False keywords['nombre'] = False keywords['apellidos'] = False keywords['num soport validez'] = False ocrs = {'date_expires': '210919', 'date_birth': '781009', 'nat': 'esp', 'country': 'esp', 'dni': '56933095f', 'sex': 'f', 'surnames': 'sanchoz de la blancakpuente', 'names': 'm'} parser = DNIScumParser(DNI_OLD) result = parser.parse() self.assertResult(result, [date(year=2021, month=9, day=19)], keywords, ocrs)
def test_dni_new_no_back_no_correct_dates(self): keywords = dict(self.keywords) keywords['domicilio'] = False keywords['primer apellido'] = False keywords['segundo apellido'] = False keywords['dni num'] = False keywords['valido hasta'] = False keywords['lugar de domicilio'] = False keywords['hijo/a de'] = False keywords['equipo'] = False keywords['lugar de nacimiento'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False ocrs = {} parser = DNIScumParser(DNI_NEW_NO_BACK_ERROR_DATES) result = parser.parse() self.assertResult(result, [], keywords, ocrs)
def test_dni_new_no_back(self): keywords = dict(self.keywords) keywords['domicilio'] = False keywords['primer apellido'] = False keywords['segundo apellido'] = False keywords['dni num'] = False keywords['valido hasta'] = False keywords['lugar de domicilio'] = False keywords['hijo/a de'] = False keywords['equipo'] = False keywords['lugar de nacimiento'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False ocrs = {} parser = DNIScumParser(DNI_NEW_NO_BACK) result = parser.parse() self.assertResult(result, [date(year=1983, month=11, day=17), date(year=2026, month=4, day=12)], keywords, ocrs)
def test_dni_new(self): keywords = dict(self.keywords) keywords['domicilio'] = False keywords['primer apellido'] = False keywords['segundo apellido'] = False keywords['dni num'] = False keywords['valido hasta'] = False keywords['lugar de domicilio'] = False keywords['hijo/a de'] = False keywords['equipo'] = False keywords['lugar de nacimiento'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False ocrs = {'date_expires': u'260412', 'surnames': u'alvarez dorado', 'date_birth': u'831117', 'names': u'ramon', 'nat': u'esp', 'country': u'esp', 'dni': u'04900073d', 'sex': u'm'} parser = DNIScumParser(DNI_NEW) result = parser.parse() self.assertResult(result, [date(year=1983, month=11, day=17), date(year=2026, month=4, day=12)], keywords, ocrs)
def test_dni_old_no_back_cat(self): keywords = self.keywords.copy() keywords['segundo apellido'] = False keywords['equipo'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False keywords["apellidos"] = False keywords["num soport validez"] = False keywords["fecha de nacimiento"] = False keywords["sexo nacionalidad"] = False keywords["valido hasta"] = False keywords["domicilio"] = False keywords["idesp"] = False keywords["hijo/a de"] = False keywords["lugar de nacimiento"] = False keywords['nombre'] = False keywords['primer apellido'] = False ocrs = {} parser = DNIScumParser(DNI_OLD_NO_BACK_CAT) result = parser.parse() self.assertResult(result, [date(year=2025, month=1, day=23)], keywords, ocrs)
def test_dni_old_cat(self): keywords = self.keywords.copy() keywords['segundo apellido'] = False keywords['equipo'] = False keywords['lugar de domicilio'] = False keywords['dni'] = False keywords['provincia/pais'] = False keywords["apellidos"] = False keywords["num soport validez"] = False keywords["fecha de nacimiento"] = False keywords["sexo nacionalidad"] = False keywords["valido hasta"] = False keywords["domicilio"] = False keywords["idesp"] = False keywords["hijo/a de"] = False keywords["lugar de nacimiento"] = False keywords['nombre'] = False keywords['primer apellido'] = False ocrs = {'date_expires': u'240123', 'date_birth': u'730116', 'nat': u'esp', 'country': u'esp', 'dni': u'52522003r', 'sex': u'm'} parser = DNIScumParser(DNI_OLD_CAT) result = parser.parse() self.assertResult(result, [date(year=2025, month=1, day=23)], keywords, ocrs)