Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add else clause to catch a case where ValidationError does not happen in pydantic example #366

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

sobolevn
Copy link
Contributor

No description provided.

@sobolevn
Copy link
Contributor Author

This does not seem related:

 lint: commands[3]> python scripts/astpath_lint.py src/ scripts/ examples/ benchmarks/benchmarks/pybench/ docs/examples/ docs/custom_ext/ tests/
no issues found
  lint: FAIL code 1 (42.57=setup[6.18]+cmd[0.07,20.52,14.12,1.68] seconds)
  evaluation failed :( (42.76 seconds)
error: Recipe `lint` failed on line 22 with exit code 1
Error: Process completed with exit code 1.

@zhPavel
Copy link
Member

zhPavel commented Mar 3, 2025

@sobolevn
Hello! Thank you for your contribution! The main purpose of these examples is demonstration of code behavior, I think that such additions make readability worse.

If you are interesting to exclude possible errors with exception skipped, there are idea to use pytest.raises() context manager inside examples. I have some doubts about this way since documentation examples start look like tests but pytest primitives should be clear to any reader.

@sobolevn
Copy link
Contributor Author

sobolevn commented Mar 3, 2025

I think that such additions make readability worse.

Current code says: ignore ValidationError if it happens.
My version says: ValidationError must happen here.

@sobolevn
Copy link
Contributor Author

sobolevn commented Mar 3, 2025

Anyways, I don't really have a strong opinion about it, so feel free to close :)

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.

2 participants