Skip to content

Commit 0b28a53

Browse files
Bounded validator prevents itself from being used to create an Unbounded validator
1 parent 13ff8e4 commit 0b28a53

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/penn_chime/validators/validators.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ def __init__(
1212
self,
1313
lower_bound: Optional[float] = None,
1414
upper_bound: Optional[float] = None) -> None:
15+
assert lower_bound is not None or upper_bound is not None, "Do not use this object to create an unbounded validator."
1516
self.lower_bound = lower_bound
1617
self.upper_bound = upper_bound
1718
self.message = {
1819
(lower_bound, upper_bound): f"in ({self.lower_bound}, {self.upper_bound})",
1920
(None, upper_bound): f"less than {self.upper_bound}",
2021
(lower_bound, None): f"greater than {self.lower_bound}",
21-
(None, None): "ACTUALLY the value is unbounded"
2222
}
2323

2424
def validate(self, value):

0 commit comments

Comments
 (0)