mirror of
https://github.com/kennethreitz/pydantic.git
synced 2026-06-05 23:00:18 +00:00
Add to upper function for strings and bytes (#4165)
* feat: add to upper function for strings and bytes * docs(changes): add message for change * fix: add constr upper on types * fix: add constr upper on types * feat: add examples and doc usage * test: add test to upper for types * chore: apply suggestions from code review Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com> * chore(docs): reorder `anystr_upper` to under `anystr_lower` * fix(test): adjust parametrizes to constrained bytes upper * refactor: use pytest parametrize for unify test constrained str upper * refactor: use pytest parametrize for unify test constrained str lower * refactor(test): use pytest parametrize for unify test any str upper * refactor(test): use pytest parametrize for unify test any str lower * refactor(test): use pytest parametrize for unify test constrained bytes lower * refactor(test): use pytest parametrize for unify test any str strip whitespace * refactor(test): change test signatures to improve readability Co-authored-by: Hasan Ramezani <hasan.r67@gmail.com>
This commit is contained in:
@@ -25,6 +25,9 @@ _(This script is complete, it should run "as is")_
|
||||
**`anystr_strip_whitespace`**
|
||||
: whether to strip leading and trailing whitespace for str & byte types (default: `False`)
|
||||
|
||||
**`anystr_upper`**
|
||||
: whether to make all characters uppercase for str & byte types (default: `False`)
|
||||
|
||||
**`anystr_lower`**
|
||||
: whether to make all characters lowercase for str & byte types (default: `False`)
|
||||
|
||||
|
||||
@@ -910,6 +910,7 @@ The following arguments are available when using the `condecimal` type function
|
||||
The following arguments are available when using the `constr` type function
|
||||
|
||||
- `strip_whitespace: bool = False`: removes leading and trailing whitespace
|
||||
- `to_upper: bool = False`: turns all characters to uppercase
|
||||
- `to_lower: bool = False`: turns all characters to lowercase
|
||||
- `strict: bool = False`: controls type coercion
|
||||
- `min_length: int = None`: minimum length of the string
|
||||
@@ -921,6 +922,7 @@ The following arguments are available when using the `constr` type function
|
||||
The following arguments are available when using the `conbytes` type function
|
||||
|
||||
- `strip_whitespace: bool = False`: removes leading and trailing whitespace
|
||||
- `to_upper: bool = False`: turns all characters to uppercase
|
||||
- `to_lower: bool = False`: turns all characters to lowercase
|
||||
- `min_length: int = None`: minimum length of the byte string
|
||||
- `max_length: int = None`: maximum length of the byte string
|
||||
|
||||
Reference in New Issue
Block a user