Skip to content

Commit 2b16694

Browse files
committed
Test parser rejects steps not using title-cased step keywords
1 parent 9801a28 commit 2b16694

File tree

1 file changed

+46
-0
lines changed

1 file changed

+46
-0
lines changed

tests/feature/test_steps.py

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import textwrap
2+
from idlelib.iomenu import errors
23

34

45
def test_steps(pytester):
@@ -620,3 +621,48 @@ def _(stuff):
620621
"*Tearing down...*",
621622
]
622623
)
624+
625+
626+
def test_lower_case_and(pytester):
627+
pytester.makefile(
628+
".feature",
629+
steps=textwrap.dedent(
630+
"""\
631+
Feature: Step keywords need to be capitalised
632+
633+
Scenario: Step keywords must be capitalised
634+
Given that I'm writing an example
635+
and that I like the lowercase 'and'
636+
Then it should fail to parse
637+
"""
638+
),
639+
)
640+
pytester.makepyfile(
641+
textwrap.dedent(
642+
"""\
643+
import pytest
644+
from pytest_bdd import given, when, then, scenarios
645+
646+
scenarios("steps.feature")
647+
648+
649+
@given("that I'm writing an example")
650+
def _():
651+
pass
652+
653+
654+
@given("that I like the lowercase 'and'")
655+
def _():
656+
pass
657+
658+
659+
@then("it should fail to parse")
660+
def _():
661+
pass
662+
663+
"""
664+
)
665+
)
666+
result = pytester.runpytest()
667+
result.assert_outcomes(errors=1)
668+
result.stdout.fnmatch_lines("*TokenError*")

0 commit comments

Comments
 (0)