Skip to content

Commit

Permalink
clarify documentation of strip_whitespace (pydantic#9471)
Browse files Browse the repository at this point in the history
  • Loading branch information
micheleAlberto committed May 21, 2024
1 parent f356552 commit c89968b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
2 changes: 1 addition & 1 deletion pydantic/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ class StringConstraints(annotated_types.GroupedMetadata):
Apply constraints to `str` types.
Attributes:
strip_whitespace: Whether to strip whitespace from the string.
strip_whitespace: Whether to remove leading and trailing whitespace.
to_upper: Whether to convert the string to uppercase.
to_lower: Whether to convert the string to lowercase.
strict: Whether to validate the string in strict mode.
Expand Down
2 changes: 2 additions & 0 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -1278,6 +1278,8 @@ def __bool__(self) -> bool:
('bool_check', BoolCastable(), ValidationError),
('str_check', 's', 's'),
('str_check', ' s ', 's'),
('str_check', ' leading', 'leading'),
('str_check', 'trailing ', 'trailing'),
('str_check', b's', 's'),
('str_check', b' s ', 's'),
('str_check', bytearray(b's' * 5), 'sssss'),
Expand Down

0 comments on commit c89968b

Please sign in to comment.