From b2a1796b8e1de53ceea44130e75a1edbfe136283 Mon Sep 17 00:00:00 2001 From: Sai Medhini Reddy Maryada <117196660+saimedhi@users.noreply.github.com> Date: Sat, 16 Mar 2024 04:58:10 -0700 Subject: [PATCH] Fixed yaml test runner (#696) Signed-off-by: saimedhi --- test_opensearchpy/test_server/test_rest_api_spec.py | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/test_opensearchpy/test_server/test_rest_api_spec.py b/test_opensearchpy/test_server/test_rest_api_spec.py index d5b47102..d493caf6 100644 --- a/test_opensearchpy/test_server/test_rest_api_spec.py +++ b/test_opensearchpy/test_server/test_rest_api_spec.py @@ -371,10 +371,10 @@ class YamlRunner: if ( isinstance(expected, str) - and expected.startswith("/") - and expected.endswith("/") + and expected.strip().startswith("/") + and expected.strip().endswith("/") ): - expected = re.compile(expected[1:-1], re.VERBOSE | re.MULTILINE) + expected = re.compile(expected.strip()[1:-1], re.VERBOSE | re.MULTILINE) assert expected.search(value), "%r does not match %r" % ( value, expected, @@ -417,9 +417,7 @@ class YamlRunner: value = value.replace(key_replace, v) break - if isinstance(value, string_types): - value = value.strip() - elif isinstance(value, dict): + if isinstance(value, dict): value = dict((k, self._resolve(v)) for (k, v) in value.items()) elif isinstance(value, list): value = list(map(self._resolve, value))