Validation Options¶
You've got choices for validation. .is_valid()
will check your MPAN string
and return a boolean value indicating whether it's valid or not, or you can
call .check()
on an MPAN
instance, which will explode with an
InvalidMpanError
if your string doesn't check out.
Note
An important note about validation
There are four aspects of validation performed by the validation checks below: the profile class and meter time switch code (if provided as part of the top line in a long MPAN) will be checked against a list of known values, the distributor from the core will be similarly checked, and finally the formula for the check digit will be applied.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
|
Helpers¶
There's also a shortcut if you just want validation:
1 2 3 4 5 6 |
|