Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Docstrings are dedented to first line, not to opening """ #43

Open
aisrael opened this issue Jun 30, 2024 · 0 comments
Open

Docstrings are dedented to first line, not to opening """ #43

aisrael opened this issue Jun 30, 2024 · 0 comments

Comments

@aisrael
Copy link

aisrael commented Jun 30, 2024

Summary

(Originally opened as cucumber-rs/cucumber#339.)

According to the documentation:

NOTE: Indentation of the opening """ is unimportant, although the common practice is to indent them. The indentation inside the triple quotes, however, is significant. Each line of the doc string will be dedented according to the opening """. Indentation beyond the column of the opening """ will therefore be preserved.

However, in testing, when writing steps with docstrings, lines inside the triple backticks (```) or triple quotes (""") are dedented according to the first line.

Examples

The following two steps result in identical docstrings:

And the output should contain:
  """
  "id": 42,
  "foo": "bar",
  """

And

And the output should contain:
  """
    "id": 42,
    "foo": "bar",
  """

However, the following results in the second line being indented by two spaces:

And the output should contain:
  """
    "id": 42,
      "foo": "bar",
  """

I can provide a minimum reproducible example (MRE) if requested.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant