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

Nested rule doesn't consume all needed backgrounds #126

Open
elchupanebrej opened this issue Jun 25, 2023 · 3 comments
Open

Nested rule doesn't consume all needed backgrounds #126

elchupanebrej opened this issue Jun 25, 2023 · 3 comments

Comments

@elchupanebrej
Copy link

👓 What did you see?

feature = """
Feature: Nested rules
  Background:
    Given Feature background

  Rule: Outer rule
    Background:
      Given Outer rule background step

    Rule: Nested rule
      Background:
        Given Nested background rule step

      Example:
        Then Scenario step
"""

from gherkin.parser import Parser
from gherkin.pickles.compiler import Compiler
parser = Parser()
gherkin_document = parser.parse(feature)
gherkin_document["uri"] = 'local'
pickles = Compiler().compile(gherkin_document)

I get next pickle:

[{'astNodeIds': ['8'],
  'id': '3',
  'language': 'en',
  'name': '',
  'steps': [{'astNodeIds': ['0'],
             'id': '0',
             'text': 'Feature background',
             'type': 'Context'},
            {'astNodeIds': ['5'],
             'id': '1',
             'text': 'Nested background rule step',
             'type': 'Context'},
            {'astNodeIds': ['7'],
             'id': '2',
             'text': 'Scenario step',
             'type': 'Outcome'}],
  'tags': [],
  'uri': 'local'}]

so Outer rule background step is missing in the pickle

✅ What did you expect to see?

All 4 steps from every level background is present in the pickle

📦 Which tool/library version are you using?

Python 3.10.9
gherkin-official 24.1.0

This text was originally generated from a template, then edited by hand. You can modify the template here.

@luke-hill
Copy link
Contributor

I'm 95% certain we test this in our acceptance tests. However you are using quite an old version (So it maybe something we've only introduced recently).

I do know python is one of the versions that has slightly less usage, that might be why.

@mpkorstanje
Copy link
Contributor

A quick guess would be that we fixed this somewhere after the mono repo split. We haven't released the python module since. #148.

@elchupanebrej
Copy link
Author

gherkin-official 29.0 - Reproduced

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

No branches or pull requests

3 participants