Skip to content

Commit 093e0a0

Browse files
committed
Simplify test
1 parent 3a730e4 commit 093e0a0

File tree

1 file changed

+16
-25
lines changed

1 file changed

+16
-25
lines changed

tests/feature/test_cucumber_json.py

Lines changed: 16 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -283,32 +283,18 @@ def test_passing_outline():
283283

284284

285285
def test_converters_dict_with_expand_option(testdir):
286-
"""Test step trace."""
287-
testdir.makefile(
288-
".ini",
289-
pytest=textwrap.dedent(
290-
"""
291-
[pytest]
292-
markers =
293-
feature-tag
294-
scenario-outline-passing-tag
295-
"""
296-
),
297-
)
286+
"""Test that `--cucumber-json-expanded` works correctly when using `example_converters`."""
298287
testdir.makefile(
299288
".feature",
300289
test=textwrap.dedent(
301290
"""
302-
@feature-tag
303-
Feature: One scenario outline, expanded to multiple scenarios
304-
305-
@scenario-outline-passing-tag
291+
Feature: Expanded option with example converters
306292
Scenario: Passing outline
307-
Given intvalue <intvalue> and stringvalue <stringvalue> and floatvalue <floatvalue>
293+
Given there is an intvalue <intvalue> and stringvalue <stringvalue> and floatvalue <floatvalue>
308294
309295
Examples: example1
310-
| intvalue| stringvalue | floatvalue |
311-
| 1 | hello | 1.0 |
296+
| intvalue | stringvalue | floatvalue |
297+
| 1 | hello | 1.0 |
312298
"""
313299
),
314300
)
@@ -317,12 +303,16 @@ def test_converters_dict_with_expand_option(testdir):
317303
"""
318304
import pytest
319305
from pytest_bdd import given, scenario
320-
321-
@given('intvalue <intvalue> and stringvalue <stringvalue> and floatvalue <floatvalue>')
306+
307+
@given('there is an intvalue <intvalue> and stringvalue <stringvalue> and floatvalue <floatvalue>')
322308
def type_type_and_value_value():
323-
return 'pass'
324-
325-
@scenario('test.feature', 'Passing outline', example_converters=dict(intvalue=int, stringvalue=str, floatvalue=float))
309+
pass
310+
311+
@scenario(
312+
'test.feature',
313+
'Passing outline',
314+
example_converters={"intvalue":int, "stringvalue":str, "floatvalue":float},
315+
)
326316
def test_passing_outline():
327317
pass
328318
"""
@@ -331,4 +321,5 @@ def test_passing_outline():
331321
result, jsonobject = runandparse(testdir, "--cucumber-json-expanded")
332322
assert result.ret == 0
333323

334-
assert jsonobject[0]["elements"][0]["steps"][0]["name"] == "intvalue 1 and stringvalue hello and floatvalue 1.0"
324+
expanded_step_name = jsonobject[0]["elements"][0]["steps"][0]["name"]
325+
assert expanded_step_name == "there is an intvalue 1 and stringvalue hello and floatvalue 1.0"

0 commit comments

Comments
 (0)