Skip to content

Datatable parsing, wrongly escape regexp "\w" #364

Open
@neskk

Description

@neskk

👓 What did you see?

I use some regexp on data-tables to perform some assertions.
Parsing the datatable below:

And the response body contains:
  | var1      | [matches regexp] abc\|cde     |
  | var2      | [matches regexp] \w+\|cde     |
  | var3      | [matches regexp] \\w+\|cde    |

I get ['var2', '[matches regexp] \\\\w+|cde'] and ['var3', '[matches regexp] \\\\w+|cde'] , which breaks my matcher.

✅ What did you expect to see?

I would expect the second row parsed to be:

  • ['var2', '[matches regexp] \w+|cde']
    but instead I get:
  • ['var2', '[matches regexp] \\\\w+|cde']
    which breaks my matcher.

I would expect the third row parsed to be:

  • ['var3', '[matches regexp] \w+|cde']
    but instead I also get:
  • ['var3', '[matches regexp] \\\\w+|cde']

📦 Which tool/library version are you using?

python 3.10
pytest-bdd 8.1.0
gherkin-official 29.0.0

🔬 How could we reproduce it?

  1. Create a step-defintion that expects a datatable.
  2. Create a feature file that submits the datatable with \w+ or other regex pattern.
  3. Log/print the received datatable.

📚 Any additional context?

No response

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions