Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
L
lettuce
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
lettuce
Commits
bff3100a
Commit
bff3100a
authored
Oct 27, 2010
by
Francisco Souza
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed #77, ignoring commented lines on scenario examples
parent
ff2ed6ab
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
30 additions
and
0 deletions
+30
-0
lettuce/strings.py
+3
-0
tests/unit/test_scenario_parsing.py
+27
-0
No files found.
lettuce/strings.py
View file @
bff3100a
...
...
@@ -104,7 +104,10 @@ def parse_hashes(lines):
return
unicode
(
line
.
replace
(
"
\\
|"
,
escape
))
.
strip
()
def
deline
(
line
):
return
line
.
replace
(
escape
,
'|'
)
def
discard_comments
(
lines
):
return
[
line
for
line
in
lines
if
not
line
.
startswith
(
'#'
)]
lines
=
discard_comments
(
lines
)
lines
=
map
(
enline
,
lines
)
keys
=
[]
...
...
tests/unit/test_scenario_parsing.py
View file @
bff3100a
...
...
@@ -101,6 +101,21 @@ Scenario: Adding some students to my university database
And I see the 2nd line of 'courses.txt' has 'Nutrition:4'
"""
OUTLINED_SCENARIO_WITH_COMMENTS_ON_EXAMPLES
=
"""
Scenario Outline: Add two numbers
Given I have entered <input_1> into the calculator
And I have entered <input_2> into the calculator
When I press <button>
Then the result should be <output> on the screen
Examples:
| input_1 | input_2 | button | output |
| 20 | 30 | add | 50 |
#| 2 | 5 | add | 7 |
| 0 | 40 | add | 40 |
# end of the scenario
"""
from
lettuce.core
import
Step
from
lettuce.core
import
Scenario
from
lettuce.core
import
Feature
...
...
@@ -297,3 +312,15 @@ def test_scenario_with_table_and_no_step_fails():
"A step table imediately after the scenario line, without step line fails"
assert_raises
(
LettuceSyntaxError
,
Scenario
.
from_string
,
SCENARIO_FAILED
)
def
test_scenario_ignore_commented_lines_from_examples
():
"Comments on scenario example should be ignored"
scenario
=
Scenario
.
from_string
(
OUTLINED_SCENARIO_WITH_COMMENTS_ON_EXAMPLES
)
assert_equals
(
scenario
.
outlines
,
[
{
'input_1'
:
'20'
,
'input_2'
:
'30'
,
'button'
:
'add'
,
'output'
:
'50'
},
{
'input_1'
:
'0'
,
'input_2'
:
'40'
,
'button'
:
'add'
,
'output'
:
'40'
},
]
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment