Skip to content

Commit 583379c

Browse files
committed
correct gherkin_kw typing
1 parent 43ffc76 commit 583379c

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

robotmbt/suitedata.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -119,19 +119,19 @@ def split_at_step(self, stepindex: int):
119119

120120
class Step:
121121
def __init__(self, steptext: str, *args, parent: Suite | Scenario, assign: tuple[str] = (),
122-
prev_gherkin_kw: Literal['given', 'when', 'then', 'none'] | None = None):
122+
prev_gherkin_kw: Literal['given', 'when', 'then'] | None = None):
123123
# org_step is the first keyword cell of the Robot line, including step_kw,
124124
# excluding positional args, excluding variable assignment.
125125
self.org_step: str = steptext
126126
# org_pn_args are the positional and named arguments as parsed
127127
# from the Robot text ('posA' , 'posB', 'named1=namedA')
128-
self.org_pn_args = args
128+
self.org_pn_args: tuple[str, ...] = args
129129
self.parent: Suite | Scenario = parent # Parent scenario for easy searching and processing.
130130
# For when a keyword's return value is assigned to a variable.
131131
# Taken directly from Robot.
132132
self.assign: tuple[str] = assign
133133
# gherkin_kw is one of 'given', 'when', 'then', or None for non-bdd keywords.
134-
self.gherkin_kw: str | None = self.step_kw if \
134+
self.gherkin_kw = self.step_kw if \
135135
str(self.step_kw).lower() in ['given', 'when', 'then', 'none'] else prev_gherkin_kw
136136
self.signature: str | None = None # Robot keyword with its embedded arguments in ${...} notation.
137137
self.args: StepArguments = StepArguments() # embedded arguments list of StepArgument objects.
@@ -202,11 +202,12 @@ def posnom_args_str(self) -> tuple[str, ...]:
202202
return tuple(result)
203203

204204
@property
205-
def gherkin_kw(self) -> Literal['given', 'when', 'then', 'none'] | None:
205+
def gherkin_kw(self) -> Literal['given', 'when', 'then'] | None:
206206
return self._gherkin_kw
207207

208208
@gherkin_kw.setter
209-
def gherkin_kw(self, value: Literal['given', 'when', 'then', 'none'] | None):
209+
def gherkin_kw(self, value: str | None):
210+
"""if value is type str, it must be a case insensitive variant of given, when, then"""
210211
self._gherkin_kw = value.lower() if value else None
211212

212213
@property

0 commit comments

Comments
 (0)