Functional Weave
Code in Python

validation.lei@1.0.0

vectors.json

2,527 bytes · view raw

[
  { "name": "GLEIF's own LEI", "args": ["506700GE1G29325QX363"], "expect": { "valid": true, "normalised": "506700GE1G29325QX363", "louPrefix": "5067", "reason": null } },
  { "name": "Apple Inc.'s published LEI", "args": ["HWUPKR0MPOU8FGXBT394"], "expect": { "valid": true, "normalised": "HWUPKR0MPOU8FGXBT394", "louPrefix": "HWUP", "reason": null } },
  { "name": "Deutsche Bank's published LEI", "args": ["7LTWFZYICNSX8D621K86"], "expect": { "valid": true, "normalised": "7LTWFZYICNSX8D621K86", "louPrefix": "7LTW", "reason": null } },
  { "name": "a published LEI from the 5493 LOU", "args": ["5493001KJTIIGC8Y1R12"], "expect": { "valid": true, "normalised": "5493001KJTIIGC8Y1R12", "louPrefix": "5493", "reason": null } },
  { "name": "lower case and spaces are normalised", "args": ["5067 00ge 1g29 325q x363"], "expect": { "valid": true, "normalised": "506700GE1G29325QX363", "louPrefix": "5067", "reason": null } },
  { "name": "the last check digit off by one", "args": ["506700GE1G29325QX364"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-check-digit" } },
  { "name": "two adjacent characters transposed", "args": ["506700EG1G29325QX363"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-check-digit" } },
  { "name": "a single character changed in the body", "args": ["HWUPKR0MPOU8FGXBT494"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-check-digit" } },
  { "name": "a letter among the check digits is a bad format", "args": ["506700GE1G29325QX3A3"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-format" } },
  { "name": "nineteen characters is too short", "args": ["506700GE1G29325QX36"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-length" } },
  { "name": "twenty-one characters is too long", "args": ["506700GE1G29325QX3630"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-length" } },
  { "name": "a hyphen is a bad character, reported before the length", "args": ["506700-GE1G29325QX363"], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "bad-character" } },
  { "name": "the empty string", "args": [""], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "empty" } },
  { "name": "a non-string is empty, not an exception", "args": [null], "expect": { "valid": false, "normalised": null, "louPrefix": null, "reason": "empty" } }
]