Skip to content

Conversation

adriangb
Copy link
Member

@adriangb adriangb commented Jul 15, 2023

Fixes #775

Selected Reviewer: @dmontagu

@codecov
Copy link

codecov bot commented Jul 15, 2023

Codecov Report

Merging #776 (9146d3a) into main (65aee42) will not change coverage.
The diff coverage is 100.00%.

❗ Current head 9146d3a differs from pull request most recent head 1cc0429. Consider uploading reports for the commit 1cc0429 to get more accurate results

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #776   +/-   ##
=======================================
  Coverage   93.67%   93.67%           
=======================================
  Files          99       99           
  Lines       14290    14290           
  Branches       25       25           
=======================================
  Hits        13386    13386           
  Misses        898      898           
  Partials        6        6           
Impacted Files Coverage Δ
src/validators/function.rs 91.36% <100.00%> (ø)

Continue to review full report in Codecov by Sentry.

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

@codspeed-hq
Copy link

codspeed-hq bot commented Jul 15, 2023

CodSpeed Performance Report

Merging #776 will not alter performance

Comparing fix-ValidationInfo-repr (1cc0429) with main (3597351)

Summary

✅ 126 untouched benchmarks

@adriangb
Copy link
Member Author

please review

@adriangb
Copy link
Member Author

adriangb commented Jul 16, 2023

@dmontagu let me know if you think this needs a test or not. I hate testing reprs, I almost always find that the benefit / cost (brittle tests) is not there since ideally nothing should be parsing the repr programmatically -> the worst case is that users see an incorrect repr and report it (like happened to lead to this PR).

@davidhewitt
Copy link
Contributor

While I agree that testing reprs is annoying I think there is value in having a test; ultimately quality of user experience can be degraded by a broken repr even if it's unlikely to cause a production crash.

@davidhewitt
Copy link
Contributor

Having tests also makes the reviewer's life easier because it makes it clearer what the new output is ;)

@adriangb
Copy link
Member Author

Ok will add one

@adriangb
Copy link
Member Author

Done in 2d759bd


v.validate_python(Foo())

# insert_assert(reprs)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this some kind of helper to update the test? 🤔

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yup comes from devtools that Samuel made

Comment on lines +970 to +973
assert reprs == [
'ValidationInfo(config=None, context=None)',
"FieldValidationInfo(config=None, context=None, field_name='x')",
]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be nice to also have the case with data present, though I'll forgive you for not having it 😂

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it’s tested elsewhere

@adriangb adriangb merged commit fe9a462 into main Jul 17, 2023
@adriangb adriangb deleted the fix-ValidationInfo-repr branch July 17, 2023 16:17
davidhewitt pushed a commit to pydantic/pydantic that referenced this pull request Oct 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

PlainValidator's info has data in repr but raises AttributeError

3 participants