Skip to content

Ignore empty space at the begin of the got string even if the expected does not use <...> #275

@eldipa

Description

@eldipa

Describe the feature you'd like
It is not uncommon to have a code that outputs one or more empty lines at the begin of stream before writing anything else.

Because byexample requires non-empty lines in the expected string, the user must or use <...> or +rm=~ plus possibly +norm-ws.

This obviously is annoying.

The proposal is to ignore any empty line (with or without spaces) at the begin of the got.

Additional context (optional)
Considerations:

>>> print("\n  \nSome line") # should work as it is correct
<...>
Some line

>>> print("\n  \nSome line") # should work as it is correct
<...>Some line

>>> print("\n  \nSome line") # should work too (empty lines skipped) 
Some line
>>> print("\n  \n  Some line") # should fail (missing indentation)
<...>
Some line

>>> print("\n  \n  Some line") # should work as it is correct
<...>Some line

>>> print("\n  \n  Some line") # should fail (missing indentation) 
Some line
>>> print("\n  \n  Some line") # +norm-ws should work
<...>
Some line

>>> print("\n  \n  Some line") # +norm-ws should work
<...>Some line

>>> print("\n  \n  Some line")  # +norm-ws should work 
Some line

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementsomething nice to have but it is not neither critical nor urgent

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions