(code: str, name: str, allowed: Collection[str])
| 27 | |
| 28 | |
| 29 | def check_code(code: str, name: str, allowed: Collection[str]) -> None: |
| 30 | wrong = [] |
| 31 | for char in code: |
| 32 | if char not in allowed: |
| 33 | wrong.append(char) |
| 34 | if wrong: |
| 35 | raise IllegalCharacterError( |
| 36 | "The following characters are not valid for {name}: {wrong}".format( |
| 37 | name=name, wrong=", ".join(wrong) |
| 38 | ) |
| 39 | ) |
| 40 | |
| 41 | |
| 42 | class Code39(Barcode): |
no test coverage detected