Skip to content

Commit

Permalink
removeprefix is Python 3.9 only :(
Browse files Browse the repository at this point in the history
  • Loading branch information
davidhewitt committed Aug 21, 2023
1 parent b994234 commit 63cee1d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion tests/validators/test_union.py
Original file line number Diff line number Diff line change
Expand Up @@ -499,7 +499,9 @@ class SpecialValues(str, Enum):
def remove_prefix(v: str):
nonlocal validator_called_count
validator_called_count += 1
return v.removeprefix('uuid::')
if v.startswith('uuid::'):
return v[6:]
return v

prefixed_uuid_schema = core_schema.no_info_before_validator_function(remove_prefix, core_schema.uuid_schema())

Expand Down

0 comments on commit 63cee1d

Please sign in to comment.