File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1919 - id : auto-walrus
2020
2121 - repo : https://github.com/astral-sh/ruff-pre-commit
22- rev : v0.15.20
22+ rev : v0.16.1
2323 hooks :
2424 - id : ruff-check
2525 - id : ruff-format
Original file line number Diff line number Diff line change @@ -13,7 +13,21 @@ def encode(plain: str) -> list[int]:
1313 """
1414 >>> encode("myname")
1515 [13, 25, 14, 1, 13, 5]
16+ >>> encode("abCd")
17+ Traceback (most recent call last):
18+ ...
19+ ValueError: plain must contain only lowercase letters (a-z)
20+ >>> encode("n0w")
21+ Traceback (most recent call last):
22+ ...
23+ ValueError: plain must contain only lowercase letters (a-z)
24+ >>> encode("later!")
25+ Traceback (most recent call last):
26+ ...
27+ ValueError: plain must contain only lowercase letters (a-z)
1628 """
29+ if not plain .islower () or not plain .isalpha ():
30+ raise ValueError ("plain must contain only lowercase letters (a-z)" )
1731 return [ord (elem ) - 96 for elem in plain ]
1832
1933
You can’t perform that action at this time.
0 commit comments