pytest-patterns icon indicating copy to clipboard operation
pytest-patterns copied to clipboard

Allow ... to match multiple lines

Open ctheune opened this issue 1 year ago • 1 comments

I have this output that I want to match flexibly with a single in_order or continuous pattern:

E         🟢 owrap           | <!DOCTYPE html>
E         🟢 owrap           | <html lang="en">
E         🟢 owrap           |   <head>
E         🟢 owrap           |     <meta charset="utf-8">
E         🔴 owrap           |     <meta http-equiv="X-UA-Compatible" content="IE=edge">
E         🟡                 |     <meta name="viewport" content="width=device-width, initial-scale=1.0">
E         🟡                 |
E         🟡                 |     <title>Aramaki</title>
E         🟡                 |
E         🟡                 |     <!-- Custom styles for this scaffold -->
E         🟡                 |     <link href="http://example.com/static/aramaki.css?x=1707293617" rel="stylesheet">
E         🟡                 |
E         🟡                 |     <script src="http://example.com/static/htmx.min.js?x=1707293617" defer></script>
E         🟡                 |     <script src="http://example.com/static/hyperscript.min.js?x=1707293617" defer></script>
E         🟡                 |
E         🟡                 |   </head>

However, I'd like to not specify the exact number of meta and script tags, but rather use something like this:

<!DOCTYPE html>
<html lang="en">
  <head>
...
    <title>Aramaki</title>
...
  </head>

ctheune avatar Feb 07 '24 08:02 ctheune

The important part here is that I want the owrap to match all owrap lines without having to add a global optional("...") pattern that would then never hint for unexpected lines

ctheune avatar Feb 07 '24 08:02 ctheune