Example #1
0
    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)
Example #2
0
 def check(n, x):
     print (n, x)
     assert Luhn.verify(n) == x