-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Python enable markdown acceptance tests #64
Open
temyers
wants to merge
18
commits into
cucumber:main
Choose a base branch
from
temyers:python-enable-markdown-acceptance-tests
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 6 commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
e5dad4c
python: Enable markdown acceptance tests
mpkorstanje 2085773
fix: markdown - match empty lines
temyers 709372c
fix: fix typo in markdown token generation
temyers b8ce724
fix: ensure markdown table headers are matched correctly.
temyers c9c88a1
WIP - add scenario parsing manually - Markdown files make feature hea…
temyers 0ef264e
Add token test data - approval testing
temyers a697916
Revert change to testdata/good/minimal.feature.md
temyers 6387c51
fix: generate AST for markdown features. Fix AST acceptance test for…
temyers bbe4d21
test: Add test coverage to ensure consistency between javascript and …
temyers 718d07c
test: update test data using python gherkin parser
temyers e6e1269
test: update markdown pickels using javascript implementation
temyers 4fb5930
fix: Fix python pickle generation failure caused by missing matched_k…
temyers 12a3a93
test: generate markdown pickles using python implementation to remove…
temyers c0b9467
feat: Python - implement mediaType for markdown features
temyers 16fbb63
revert: re-generate parser.py using berp. No changes were necessary.
temyers 7f1790c
chore: remove dead code
temyers 6204f30
fix: update markdown test data using Python implementation following …
temyers 18b1cf0
test: add tests to demonstrate inconsistency between Javascript and P…
temyers File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,7 +6,16 @@ | |
from gherkin.gherkin_line import GherkinLine | ||
location = { 'line': 1, 'column': 1 } | ||
|
||
def test_it_matches_FeatureLine(): | ||
def test_it_matches_FeatureLineH1(): | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Outside the scope of this PR, but I recently found pytest-describe that would make it easier to match the describe style of the javascript variant I really prefer it - it enables me to structure my specifications more logically. One to think about... |
||
tm = GherkinInMarkdownTokenMatcher('en') | ||
line = GherkinLine('''# Feature: hello''',location['line']) | ||
token = Token(gherkin_line=line, location=location) | ||
assert tm.match_FeatureLine(token) | ||
assert token.matched_type == 'FeatureLine' | ||
assert token.matched_keyword == 'Feature' | ||
assert token.matched_text == 'hello' | ||
|
||
def test_it_matches_FeatureLineH2(): | ||
tm = GherkinInMarkdownTokenMatcher('en') | ||
line = GherkinLine('''## Feature: hello''',location['line']) | ||
token = Token(gherkin_line=line, location=location) | ||
|
@@ -151,11 +160,13 @@ def test_it_matches_table_separator_row_as_comment(): | |
l1 = GherkinLine(' | h1 | h2 |',location['line']) | ||
t1 = Token(l1,location) | ||
assert tm.match_TableRow(t1) | ||
assert t1.location['column'] == 3 | ||
|
||
l2 = GherkinLine(' | --- | --- |',location['line']) | ||
t2 = Token(l2,location) | ||
assert not tm.match_TableRow(t2) | ||
assert tm.match_Comment(t2) | ||
assert t2.location['column'] == 3 | ||
|
||
def test_it_matches_indented_tags(): | ||
tm = GherkinInMarkdownTokenMatcher('en') | ||
|
@@ -229,4 +240,13 @@ def test_it_matches_ExamplesLine(): | |
assert tm.match_ExamplesLine(token) | ||
assert token.matched_type == 'ExamplesLine' | ||
assert token.matched_keyword == 'Examples' | ||
assert token.matched_text == '' | ||
assert token.matched_text == '' | ||
|
||
def test_it_matches_Empty(): | ||
tm = GherkinInMarkdownTokenMatcher('en') | ||
line = GherkinLine('''''',location['line']) | ||
token = Token(gherkin_line=line, location=location) | ||
assert tm.match_Empty(token) | ||
assert token.matched_type == 'Empty' | ||
assert token.matched_keyword == None | ||
assert token.matched_text == None |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(1:4)FeatureLine:()Feature/DataTables/ | ||
(2:1)Empty:// | ||
(3:5)ScenarioLine:()Scenario/minimalistic/ | ||
(4:1)Empty:// | ||
(5:3)StepLine:()Given /a simple data table/ | ||
(6:3)TableRow:()|//5:foo,11:bar | ||
(7:3)Comment:// | ||
(8:3)TableRow:()|//5:boz,11:boo | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
(1:4)FeatureLine:()Feature/DocString variations/ | ||
(2:1)Empty:// | ||
(3:5)ScenarioLine:()Scenario/minimalistic/ | ||
(4:1)Empty:// | ||
(5:3)StepLine:()And /a DocString with an implicitly escaped separator inside/ | ||
(6:1)DocStringSeparator:()````// | ||
(7:1)Other:/```/ | ||
(8:1)DocStringSeparator:()````// | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
(1:3)FeatureLine:()Feature/Minimal/ | ||
(2:1)Empty:// | ||
(3:4)ScenarioLine:()Scenario/minimalistic/ | ||
(4:1)Empty:// | ||
(5:3)StepLine:()Given /the minimalism/ | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
(1:1)Empty:// | ||
(2:1)Empty:// | ||
(3:1)Empty:// | ||
(4:1)Empty:// | ||
(5:1)Empty:// | ||
(6:1)Empty:// | ||
(7:1)Empty:// | ||
(8:1)Empty:// | ||
(9:1)Empty:// | ||
(10:1)Empty:// | ||
(11:1)Empty:// | ||
(12:3)ScenarioLine:()Scenario/Something about math/ | ||
(13:3)StepLine:()Given /step one/ | ||
(14:3)StepLine:()When /step two/ | ||
(15:3)StepLine:()Then /step three/ | ||
(16:1)Empty:// | ||
(17:3)ScenarioLine:()Scenario/Something about gravity/ | ||
(18:4)StepLine:()Given /step one/ | ||
(19:4)StepLine:()When /step two/ | ||
(20:4)StepLine:()Then /step three/ | ||
(21:1)Empty:// | ||
(22:1)Empty:// | ||
(23:1)Empty:// | ||
(24:1)Empty:// | ||
(25:1)Empty:// | ||
EOF |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
(1:1)TagLine://2:@feature_tag1,18:@feature_tag2 | ||
(2:3)TagLine://4:@feature_tag3 | ||
(3:3)FeatureLine:()Feature/Minimal Scenario Outline/ | ||
(4:1)Empty:// | ||
(5:1)TagLine://2:@scenario_tag1,19:@scenario_tag2 | ||
(6:3)TagLine://4:@scenario_tag3 | ||
(7:4)ScenarioLine:()Scenario/minimalistic/ | ||
(8:3)StepLine:()Given /the minimalism/ | ||
(9:1)Empty:// | ||
(10:1)TagLine://2:@so_tag1,14:@so_tag2 | ||
(11:3)TagLine://4:@so_tag3 | ||
(12:4)ScenarioLine:()Scenario Outline/minimalistic outline/ | ||
(13:3)StepLine:()Given /the <what>/ | ||
(14:1)Empty:// | ||
(15:1)TagLine://2:@ex_tag1,13:@ex_tag2 | ||
(16:3)TagLine://4:@ex_tag3 | ||
(17:5)ExamplesLine:()Examples// | ||
(18:3)TableRow:()|//5:what | ||
(19:3)Comment:// | ||
(20:3)TableRow:()|//5:minimalism | ||
(21:1)Empty:// | ||
(22:1)TagLine://2:@ex_tag4,13:@ex_tag5 | ||
(23:3)TagLine://4:@ex_tag6 | ||
(24:5)ExamplesLine:()Examples// | ||
(25:3)TableRow:()|//5:what | ||
(26:3)Comment:// | ||
(27:3)TableRow:()|//5:more minimalism | ||
(28:1)Empty:// | ||
(29:1)TagLine://2:@comment_tag1 | ||
(30:4)ScenarioLine:()Scenario/comments/ | ||
(31:1)Empty:// | ||
(32:1)Empty:// | ||
(33:1)TagLine://2:@comment_tag#2 | ||
(34:4)ScenarioLine:()Scenario/hash in tags/ | ||
(35:1)Empty:// | ||
(36:1)Empty:// | ||
(37:1)TagLine://2:@rule_tag | ||
(38:4)RuleLine:()Rule// | ||
(39:1)Empty:// | ||
(40:1)TagLine://2:@joined_tag3,16:@joined_tag4 | ||
(41:5)ScenarioLine:()Scenario/joined tags/ | ||
(42:1)Empty:// | ||
EOF |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This logic is now spread across a few files (see
source_events.py
)Is there a better way to encapsulate this behaviour?
Caveat from
CONTRIBUTING.md
: