Add a guard rail around Roman.i2r
This commit is contained in:
parent
5b55118373
commit
345464d0d4
@ -102,6 +102,9 @@ class Roman:
|
|||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
def i2r(cls, i: int) -> str:
|
def i2r(cls, i: int) -> str:
|
||||||
|
if i > 100_000:
|
||||||
|
raise ValueError(f"{i} is too silly")
|
||||||
|
|
||||||
r: list[str] = []
|
r: list[str] = []
|
||||||
|
|
||||||
for int_val, roman_val in sorted(cls.ALL_REVERSE.items(), reverse=True):
|
for int_val, roman_val in sorted(cls.ALL_REVERSE.items(), reverse=True):
|
||||||
|
Loading…
Reference in New Issue
Block a user