Skip to content

Commit c2f1889

Browse files
committed
Add detailed docstrings for PositiveOrZeroInt class and its methods to enhance documentation and clarify functionality.
1 parent 14caa4b commit c2f1889

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

pyvalueobjects/numbers/positive_or_zero_int.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,23 @@
33

44

55
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+
"""
69

710
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+
"""
815
super().__init__(value)
916

1017
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+
"""
1123
super()._validate(value)
1224
if value < 0:
1325
raise ValueObjectError('Value must be greater or equals to 0.')

0 commit comments

Comments
 (0)