We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 44126b4 commit 1a72469Copy full SHA for 1a72469
1 file changed
pyvalueobjects/strings/string.py
@@ -3,13 +3,25 @@
3
4
5
class String(ValueObject):
6
+ """
7
+ A value object representing a string. Inherits from ValueObject and validates that the input is a string.
8
9
10
_ALLOWED_INPUT_TYPES = {str, int, float, bool}
11
12
def __init__(self, value: str):
13
14
+ Initialize the String object with the given string value.
15
+ :param value: A string value.
16
17
super().__init__(value)
18
19
def _validate(self, value):
20
21
+ Validate that the given value is a string.
22
+ :param value: The value to validate.
23
+ :raises: ValueObjectError if the value is not a string.
24
25
super()._validate(value)
26
input_type = type(value)
27
if input_type != str:
0 commit comments