MCPcopy Create free account
hub / github.com/pytest-dev/pytest-bdd / test_parser

Function test_parser

tests/parser/test_parser.py:23–851  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

21
22
23def test_parser():
24 test_dir = Path(__file__).parent
25 feature_file = test_dir / "test.feature"
26 feature_file_path = str(feature_file.resolve())
27
28 # Call the function to parse the Gherkin document
29 gherkin_doc = get_gherkin_document(feature_file_path)
30
31 # Define the expected structure
32 expected_document = GherkinDocument(
33 feature=Feature(
34 keyword="Feature",
35 location=Location(column=1, line=2),
36 tags=[],
37 name="User login",
38 description=" As a registered user\n I want to be able to log in\n So that I can access my account",
39 language="en",
40 children=[
41 Child(
42 background=Background(
43 id="1",
44 keyword="Background",
45 location=Location(column=3, line=8),
46 name="",
47 description="",
48 steps=[
49 Step(
50 id="0",
51 keyword="Given",
52 keyword_type="Context",
53 location=Location(column=5, line=10),
54 text="the login page is open",
55 datatable=None,
56 docstring=None,
57 )
58 ],
59 ),
60 rule=None,
61 scenario=None,
62 ),
63 Child(
64 background=None,
65 rule=None,
66 scenario=Scenario(
67 id="6",
68 keyword="Scenario",
69 location=Location(column=3, line=13),
70 name="Successful login with valid credentials",
71 description="",
72 steps=[
73 Step(
74 id="2",
75 keyword="Given",
76 keyword_type="Context",
77 location=Location(column=5, line=14),
78 text="the user enters a valid username",
79 datatable=None,
80 docstring=None,

Callers

nothing calls this directly

Calls 15

get_gherkin_documentFunction · 0.90
GherkinDocumentClass · 0.90
FeatureClass · 0.90
LocationClass · 0.90
ChildClass · 0.90
BackgroundClass · 0.90
StepClass · 0.90
ScenarioClass · 0.90
ExamplesTableClass · 0.90
RowClass · 0.90
CellClass · 0.90
TagClass · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…