Skip to content

Commit

Permalink
Update test_rest_api_spec.py
Browse files Browse the repository at this point in the history
  • Loading branch information
saimedhi authored Mar 14, 2024
1 parent a55b46c commit 9741317
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion test_opensearchpy/test_server/test_rest_api_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,7 @@ def run_do(self, action: Any) -> Any:
with warnings.catch_warnings(record=True) as caught_warnings:
try:
self.last_response = api(**args)
print("self.last_response", self.last_response)
except Exception as e:
if not catch:
raise
Expand Down Expand Up @@ -374,18 +375,25 @@ def run_match(self, action: Any) -> None:
for path, expected in action.items():
value = self._lookup(path)
expected = self._resolve(expected)

print("expected before", expected )
print("value before ", value)
if (
isinstance(expected, str)
and expected.startswith("/")
and expected.endswith("/")
):
expected = re.compile(expected[1:-1], re.VERBOSE | re.MULTILINE)
print("entered 1st condition")
print("expected", expected )
print("value", value)
assert expected.search(value), "%r does not match %r" % (
value,
expected,
)
else:
print("entered 2nd condition")
print("expected", expected )
print("value", value)
self._assert_match_equals(value, expected)

def run_contains(self, action: Any) -> None:
Expand Down

0 comments on commit 9741317

Please sign in to comment.