@@ -283,32 +283,18 @@ def test_passing_outline():
283
283
284
284
285
285
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`."""
298
287
testdir .makefile (
299
288
".feature" ,
300
289
test = textwrap .dedent (
301
290
"""
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
306
292
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>
308
294
309
295
Examples: example1
310
- | intvalue| stringvalue | floatvalue |
311
- | 1 | hello | 1.0 |
296
+ | intvalue | stringvalue | floatvalue |
297
+ | 1 | hello | 1.0 |
312
298
"""
313
299
),
314
300
)
@@ -317,12 +303,16 @@ def test_converters_dict_with_expand_option(testdir):
317
303
"""
318
304
import pytest
319
305
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>')
322
308
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
+ )
326
316
def test_passing_outline():
327
317
pass
328
318
"""
@@ -331,4 +321,5 @@ def test_passing_outline():
331
321
result , jsonobject = runandparse (testdir , "--cucumber-json-expanded" )
332
322
assert result .ret == 0
333
323
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