예제 #1
0
파일: iso.py 프로젝트: aes/numberlike
    def __new__(cls, x):
        if not Luhn.verify(x):
            raise ValueError('Luhn checksum failed')

        if x < 10000000:
            raise ValueError('Number too short')

        if x > 9999999999999999999:
            raise ValueError('Number too long')

        return super(iso7812, cls).__new__(cls, x)
예제 #2
0
 def check(n, x):
     print (n, x)
     assert Luhn.verify(n) == x