We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 14caa4b commit c2f1889Copy full SHA for c2f1889
1 file changed
pyvalueobjects/numbers/positive_or_zero_int.py
@@ -3,11 +3,23 @@
3
4
5
class PositiveOrZeroInt(Int):
6
+ """
7
+ A value object representing a positive integer or zero. Inherits from Int and validates that the input is a positive integer or zero.
8
9
10
def __init__(self, value: int):
11
12
+ Initialize the PositiveOrZeroInt object with the given positive integer or zero value.
13
+ :param value: A positive integer or zero value.
14
15
super().__init__(value)
16
17
def _validate(self, value):
18
19
+ Validate that the given value is a positive integer or zero.
20
+ :param value: The value to validate.
21
+ :raises: ValueObjectError if the value is not a positive integer or zero.
22
23
super()._validate(value)
24
if value < 0:
25
raise ValueObjectError('Value must be greater or equals to 0.')
0 commit comments