Assertions inside exceptions are silently not checked
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 65/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- python
- Domain
- testing-qa
Research direction
Start by reproducing the provided Pydantic ValidationError example in the pytest-examples plugin's handling of examples in docstrings and Markdown files. Trace how exception blocks and their assertions are evaluated; done means a test cannot pass when the expected exception is never raised, while existing valid examples continue to work.
Written by the indexing model from the issue text.
Description
e.g.:
from pydantic import BaseModel, ValidationError
class Model(BaseModel):
num: complex
try:
Model(num=complex(1)) # works
except ValidationError as exc:
print(repr(exc.errors()[0]['type']))
#> 'complex_type'
This will pass tests, because the exception was never raised. This happened several times in pydantic, where such code was indeed raising when writing, but behavior changed over time.
- Dominant language
- Python
- Stars
- 181
- Forks
- 29
- PR merge metrics
- No merged PRs in 30d
Getting set up
This project ships no dev container, Dockerfile or contributing guide, so setting up is up to you: start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from pydantic/pytest-examples
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
pydantic/pytest-examples#87 ·
-
Clean up NeededPossibly taken @Danipulok claimed this 73 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
pydantic/pytest-examples#72 · 5 comments ·
-
Feature requrest [I can do it myself if allowed]: Allow configuration of `pytest-examples` from `pyproject.toml`Possibly taken @Danipulok claimed this 38 days ago. Open
Difficulty 3/5 1-2 days Newbie friendliness 64/100
pydantic/pytest-examples#73 · 4 comments ·
-
target_versions are out of datePossibly taken @stevenh claimed this 507 days ago. Open
Difficulty 2/5 1-3 hours Newbie friendliness 45/100
pydantic/pytest-examples#63 · 1 comment ·
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
pydantic/pytest-examples#62 · 1 comment ·
All issues in pydantic/pytest-examples
Similar issues
-
Email validation accepts a trailing newlinePossibly taken @marcello-pichini claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
dbt-labs/spark-utils#51 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 85/100
Maintainers usually reply within 1 day
-
bug frontend
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
vendrabuck/HERD#1419 ·
Maintainers usually reply within 1 day