strings.is_polish_national_id ============================= .. py:module:: strings.is_polish_national_id Functions --------- .. autoapisummary:: strings.is_polish_national_id.is_polish_national_id Module Contents --------------- .. py:function:: is_polish_national_id(input_str: str) -> bool Verification of the correctness of the PESEL number. www-gov-pl.translate.goog/web/gov/czym-jest-numer-pesel?_x_tr_sl=auto&_x_tr_tl=en PESEL can start with 0, that's why we take str as input, but convert it to int for some calculations. >>> is_polish_national_id(123) Traceback (most recent call last): ... ValueError: Expected str as input, found >>> is_polish_national_id("abc") Traceback (most recent call last): ... ValueError: Expected number as input >>> is_polish_national_id("02070803628") # correct PESEL True >>> is_polish_national_id("02150803629") # wrong month False >>> is_polish_national_id("02075503622") # wrong day False >>> is_polish_national_id("-99012212349") # wrong range False >>> is_polish_national_id("990122123499999") # wrong range False >>> is_polish_national_id("02070803621") # wrong checksum False