Skip to content

Use a match statement to dispatch on gherkin Child fields#822

Open
Pierre-Sassoulas wants to merge 2 commits into
chore/dep-cves-and-py3.15from
refactor/match-gherkin-child
Open

Use a match statement to dispatch on gherkin Child fields#822
Pierre-Sassoulas wants to merge 2 commits into
chore/dep-cves-and-py3.15from
refactor/match-gherkin-child

Conversation

@Pierre-Sassoulas

Copy link
Copy Markdown
Member

Opinionated change following #821. A gherkin Child has exactly one of background/rule/scenario set; class patterns make that dispatch explicit and replace the truthiness checks with type matching.

A gherkin Child has exactly one of background/rule/scenario set; class
patterns make that dispatch explicit and replace the truthiness checks
with type matching.
@codecov

codecov Bot commented Jul 3, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 95.23810% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 96.10%. Comparing base (51962a2) to head (d87588c).

Files with missing lines Patch % Lines
src/pytest_bdd/parser.py 87.50% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@                      Coverage Diff                      @@
##           chore/dep-cves-and-py3.15     #822      +/-   ##
=============================================================
+ Coverage                      96.08%   96.10%   +0.02%     
=============================================================
  Files                             55       55              
  Lines                           2398     2412      +14     
  Branches                         136      136              
=============================================================
+ Hits                            2304     2318      +14     
  Misses                            57       57              
  Partials                          37       37              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

A Child with none of background/rule/scenario set (a child kind a future
gherkin version could introduce) must be skipped by FeatureParser.parse.
No real feature file can produce one today, so the test appends a
synthetic empty Child to the parsed document.
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.

1 participant