Skip to content

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

Open
sobolevn wants to merge 1 commit intoreagento:mainfrom
sobolevn:patch-1
Open

Add else clause to catch a case where ValidationError does not happen in pydantic example#366
sobolevn wants to merge 1 commit intoreagento:mainfrom
sobolevn:patch-1

Conversation

@sobolevn
Copy link
Copy Markdown
Contributor

No description provided.

@sobolevn
Copy link
Copy Markdown
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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor Author

sobolevn commented Mar 3, 2025

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

@sonarqubecloud
Copy link
Copy Markdown

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