Skip to content

Conversation

huyta55
Copy link
Contributor

@huyta55 huyta55 commented Sep 30, 2022

  1. Moved the if self.strip_whitespace {} code to before the minimum and maximum length checks.
  2. Changed the logic of string length test's expected value from Err('String should have at most 5 characters') to '1234' for input '1234 ', since the strip_whitespace code will now remove the spaces before the input gets to the length checks, changing the input string to 4 characters instead of 6 characters. Therefore, the input should now pass the length validation instead of throwing an error.
  3. Changed the expected value of pattern test ({'strip_whitespace': True, 'pattern': r'\d+$'}, 'foobar 123 ', Err("String should match pattern '\\d+$'")) to 'foobar 123' since the strip_whitespace now removes the trailing ' ', so the input should pass the pattern validation since a digit will be the last character in the string.

@codecov-commenter
Copy link

codecov-commenter commented Sep 30, 2022

Codecov Report

Merging #264 (457fbfc) into main (feac27e) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #264      +/-   ##
==========================================
- Coverage   98.60%   98.59%   -0.02%     
==========================================
  Files          51       51              
  Lines        5226     5330     +104     
  Branches       37       39       +2     
==========================================
+ Hits         5153     5255     +102     
- Misses         73       75       +2     
Impacted Files Coverage Δ
src/validators/string.rs 100.00% <100.00%> (ø)
pydantic_core/core_schema.py 99.68% <0.00%> (-0.32%) ⬇️
src/validators/union.rs 98.80% <0.00%> (-0.31%) ⬇️
src/lib.rs 100.00% <0.00%> (ø)
src/errors/value_exception.rs 100.00% <0.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update feac27e...457fbfc. Read the comment docs.

@samuelcolvin
Copy link
Member

great, thanks so much.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants