From 3128134d146845a79f2496c6054d88ea4fb6de7a Mon Sep 17 00:00:00 2001
From: Evan Goode <mail@evangoo.de>
Date: Fri, 13 Dec 2024 17:42:55 +0000
Subject: [PATCH] Auto insert ^ and $ for "std{out,err} contains lines
 matching"

---
 dnf-behave-tests/dnf/steps/cmd.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dnf-behave-tests/dnf/steps/cmd.py b/dnf-behave-tests/dnf/steps/cmd.py
index 0fb97c6c4..46dd80f25 100644
--- a/dnf-behave-tests/dnf/steps/cmd.py
+++ b/dnf-behave-tests/dnf/steps/cmd.py
@@ -257,7 +257,7 @@ def then_stdout_contains_lines_matching(context):
     test_lines = context.text.split('\n')
     for line in test_lines:
         for outline in out_lines:
-            if re.search(line.strip(), outline.strip()):
+            if re.search("^" + line.strip() + "$", outline.strip()):
                 break
         else:
             raise AssertionError("Stderr doesn't contain line matching: %s" % line)
@@ -321,7 +321,7 @@ def then_stderr_contains_lines_matching(context):
     test_lines = context.text.split('\n')
     for line in test_lines:
         for outline in out_lines:
-            if re.search(line.strip(), outline.strip()):
+            if re.search("^" + line.strip() + "$", outline.strip()):
                 break
         else:
             raise AssertionError("Stderr doesn't contain line matching: %s" % line)